beste SDers,
Probeer voor mijn vriendin een website op te zetten voor haar foto's die ze schiet.
Nu gebruik ik daar ProFolio (http://myprofolio.sticktacular.com/index.php)
voor en als ik het wil instaleren krijg ik dit te zien:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/rydes/domains/rydesign.nl/public_html/klanten/foto/install.php on line 6
De database enzo zijn wel goed ingevoerd.Code:<?php include("config.php"); $info_query = mysql_query("SELECT * FROM ".$prefix."ProFolio_info ORDER BY id DESC LIMIT 0,1"); if(mysql_num_rows($info_query) > 0){ $red = "Location: index.php"; header($red); die("Redirecting to ProFolio Index Page..."); } $reply = ''; if(isset($_POST['submit'])){ $username = trim(strtolower($_POST['username'])); $password = trim(strtolower($_POST['password'])); $confirm = trim(strtolower($_POST['confirm'])); if($username != '' && $password != '' && $confirm != ''){ if($password == $confirm){ //Create Files if(!file_exists('Files')){ mkdir('Files', 0777); } if(!file_exists('Files_Icons')){ mkdir('Files_Icons', 0777); } if(!file_exists('Files_Previews')){ mkdir('Files_Previews', 0777); } chmod("Files", 0777); chmod("Files_Icons", 0777); chmod("Files_Previews", 0777); //Create Tables mysql_query("CREATE TABLE `".$prefix."ProFolio_work` ( `id` int(8) NOT NULL auto_increment, `date` varchar(14) NOT NULL default '', `title` varchar(255) NOT NULL default '', `type` varchar(100) NOT NULL default '', `file` varchar(255) NOT NULL default '', `preview` varchar(255) NOT NULL default '', `icon` varchar(255) NOT NULL default '', PRIMARY KEY (`id`), FULLTEXT KEY `title` (`title`,`type`) ) TYPE=MyISAM AUTO_INCREMENT=1 ") or die(mysql_error()); mysql_query("CREATE TABLE `".$prefix."ProFolio_info` ( `id` int(5) NOT NULL auto_increment, `username` varchar(30) NOT NULL default '', `password` varchar(30) NOT NULL default '', `page_about` blob NOT NULL, `page_contact` blob NOT NULL, `firstname` varchar(50) NOT NULL default '', `lastname` varchar(50) NOT NULL default '', `email` varchar(255) NOT NULL default '', `phone` varchar(50) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1") or die(mysql_error()); mysql_query("CREATE TABLE `".$prefix."ProFolio_customize` ( `id` mediumint(4) NOT NULL auto_increment, `categories` text NOT NULL, `color_firstname` varchar(7) NOT NULL, `color_lastname` varchar(7) NOT NULL, `color_links` varchar(7) NOT NULL, `color_text` varchar(7) NOT NULL, `color_lightbox` varchar(7) NOT NULL, `color_background` varchar(7) NOT NULL, `opt_backgroundimg` varchar(255) NOT NULL default '', `opt_backgroundpos` varchar(50) NOT NULL default '', `opt_backgroundrep` varchar(20) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 ;") or die(mysql_error()); //Insert Data in DBs mysql_query("INSERT INTO ".$prefix."ProFolio_info (username, password, firstname, lastname) VALUES ('$username', '$password', 'First', 'Lastname')") or die(mysql_error()); mysql_query("INSERT INTO ".$prefix."ProFolio_customize (categories, color_firstname, color_lastname, color_links, color_text, color_lightbox, color_background, opt_backgroundimg, opt_backgroundpos, opt_backgroundrep) VALUES('Artwork, Identity, Illustration, Photography, Web Designs', '#555', '#fff', '#e1e1e1', '#ebebeb', '#000', '#000', 'Backgrounds/clouds.png', 'bottom right', 'no-repeat')") or die(mysql_error()); if(file_exists('upgrade.php')){ unlink('upgrade.php'); } //Finish and Redirect $red = "Location: index.php"; header($red); die("Redirecting to ProFolio Index Page..."); } else { $reply = "Your password and password confirmation did not match."; } } else { $reply = "Please fill out a username, password and password confirmation."; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Installing Your ProFolio</title> <style type="text/css"> * {padding:0px; margin:0px; font-size:12px; font-family:Arial, Helvetica, sans-serif; color:#0A1528; text-align:left;} .container {width:500px; border:12px solid #BECAFF; margin:100px auto 30px; display:block; padding:20px;} h1 {font-size:20px; margin-bottom:10px;} .main {line-height:20px; margin:15px 0px;} .form {padding:20px 0px 20px 40px; margin:auto;} .form p {margin: 8px 0px 2px; font-weight:bold;} .form input.field {border:1px inset #555; padding:4px; font-family:Arial, Helvetica, sans-serif; width:250px;} .footer {position:fixed; bottom:0px; right:0px; width:100%; background:url(Images/transparent80.png) repeat;} .footer p {text-align:right; padding:3px 6px; font-size:12px;} .footer a {color:#fff; text-decoration:none;} </style> </head> <body> <div class="container"> <? if($reply != ''){ ?> <p style="color:#CC0000; font-weight:bold;"><? echo $reply; ?></p> <? } ?> <h1>Installing ProFolio...</h1> <div class="main"> Congratulations, you are seconds away from having your own professional digital portfolio! Thank you for choosing ProFolio to help you build your own elegant, easy-to-manage, and secure portfolio. ProFolio was started by Zach Krasner to help artists of all types display their works in a beautifully crafted webpage that is easily customized and manageable. </div> <div class="main"> <strong>To get started with your ProFolio</strong>, you need to create an administrator username and password. You will need your username and password in order to login to your ProFolio to add pieces, manage your works, and edit your settings. Don't forget your username and password, or you won't be able to access these options of your ProFolio! Enter your desired username and password below... (<strong>Don't use</strong> apostrophes or quotation marks!) </div> <div class="main"> <p>Once you click <strong>Finish</strong> below, your ProFolio will be created! You will be transferred to your ProFolio where you can login on the top-right of the page. Once logged in, you will full control over your portfolio and can start adding pieces to it immediately. Thanks for using ProFolio!</p> </div> <div class="form"> <form action="" method="post" enctype="multipart/form-data"> <p><strong>Your Username</strong></p> <input class="field" name="username" type="text" maxlength="30" /> <p><strong>Your Password</strong></p> <input class="field" name="password" type="password" maxlength="30" /> <p><strong>Confirm Your Password</strong></p> <input class="field" name="confirm" type="password" maxlength="30" /> <p> </p> <input name="submit" value=" Finish " type="submit" /> </form> </div> </div> </body> <div class="footer"><p><a href="http://sticktacular.com/" target="_blank">Powered By ProFolio</a></p></div> </html>
Als jullie meer informatie moeten hebben moet je het zeggen.
Met vriendelijke groet,
Ronald
- Mysql fout en snap daar niet zoveel van
-
27-10-2009, 22:30 #1
- Berichten
- 1.832
- Lid sinds
- 19 Jaar
Mysql fout en snap daar niet zoveel van
-
-
27-10-2009, 22:34 #2
- Berichten
- 95
- Lid sinds
- 18 Jaar
Maak van lijn 4 eens:
PHP Code:$info_query = mysql_query("SELECT * FROM ".$prefix."ProFolio_info ORDER BY id DESC LIMIT 0,1") or die(mysql_error());
-
27-10-2009, 22:35 #3
- Berichten
- 492
- Lid sinds
- 16 Jaar
Hij geeft aan dat er een fout is op regel 6.
Op regel 6 staat dit :Code:if(mysql_num_rows($info_query) > 0){
Gaan we kijken wat $info_query is. :
Code:$info_query = mysql_query("SELECT * FROM ".$prefix."ProFolio_info ORDER BY id DESC LIMIT 0,1");
Maar doorvoor hebben we iets moois. Deze laat zien wat er fout is
Code:OR DIE (mysql_error())
Code:$info_query = mysql_query("SELECT * FROM ".$prefix."ProFolio_info ORDER BY id DESC LIMIT 0,1") OR DIE (mysql_error());
-
27-10-2009, 23:46 #4
- Berichten
- 1.483
- Lid sinds
- 16 Jaar
Ik heb het eerste deel van je code opgelapt. In plaats van mysql_num_rows() gebruik ik een tel functie in MySQL zelf namelijk MySQL COUNT.
De manier die jij toepast is echt enorm foutief, als je die SQL door phpmyadmin gooit zie je dat hij werkelijk alles uit je tabel weergeeft. Het principe is dus enorm simpel, alles wat phpmyadmin weergeeft aan de hand van een SQL wordt ook tijdens een query opgehaald naar je PHP script. Stel dat je tabel 100.000 rijen heeft, dan laadt hij alle 100.000 rijen in je PHP script dat voor een getalletje? Gebruik MySQL COUNT zeer belangrijk voor de performance van je programmeer techniek.
PHP Code:<?php
// include('config.php');
// # Include_once zorgt ervoor dat config.php nooit vaker als één keer wordt ingeladen
include_once('config.php');
// $info_query = mysql_query("SELECT * FROM ".$prefix."ProFolio_info ORDER BY id DESC LIMIT 0,1");
// # Gebruikt nooit een wildcard (*) en behandel je SQL zodanig dat het overzichtelijk is
$sql['info'] = "SELECT
COUNT(1) AS aantal
FROM `".$prefix."ProFolio_info`
ORDER BY `id` DESC
LIMIT 0,1";
$query['info'] = mysql_query($sql['info']) or die(mysql_error());
$items = mysql_fetch_assoc($query['info']);
// if(mysql_num_rows($info_query) > 0){
// # mysql_num_rows gebruiken we alleen in een bestaande query waar je al mysql_fetch_assoc of .._object gebruikt
if($items['aantal'] > 0)
{
// $red = "Location: index.php";
// header($red);
// # Waarom eerst in een variabel terwijl het ook direct kan?
header('Location: index.php');
// die("Redirecting to ProFolio Index Page...");
// # Fout. Als je header location gebruikt moet je geen output naar de browser parsen, niet ervoor niet erna.
exit();
}
?>
-
28-10-2009, 19:57 #5
- Berichten
- 1.832
- Lid sinds
- 19 Jaar
@ Allen
Bedankt voor de antwoorden.
Ik heb alles opnieuw op de server gegooid en alle code van install.php veranderd door wat hierboven staat.
Nu krijg ik de volgende fout:
Table 'rydes_foto.ProFolio_info' doesn't exist
Terwijl ik hem wel gemaakt heb:
Your database has been setup. Use the following values:
Database:rydes_foto
Hoe kan dat?
de code van config.php:
Code:<? ob_start("gzip_handler"); ob_start(); //Change the following four items to their appropriate values (Your MySQL host, Your database username, Your database password, Database Name) $host = "localhost"; $db_username = "rydes_foto"; $db_password = "xxxx"; $database = "rydes_foto"; //Optional Table Prefix (Leave blank for default) $prefix = ''; //MySQL - Do not touch. mysql_connect($host, $db_username, $db_password) or die(mysql_error()); mysql_select_db($database) or die(mysql_error()); ?>
Dit geldt tevens voor antwoord van Nigel.
Alles aangepast maar zie:
Table 'rydes_foto.ProFolio_info' doesn't exist
-
28-10-2009, 20:43 #6
- Berichten
- 492
- Lid sinds
- 16 Jaar
Ben je wel verbonden met de goeie database?
-
28-10-2009, 21:40 #7
- Berichten
- 1.832
- Lid sinds
- 19 Jaar
Jazeker
Aanvullend bericht:
Heeft iemand nog een idee?
Sorry dat ik even bump maar het wordt een site die ik op moet leveren op een verjaardag volgende week.
Groetjes!!Laatst aangepast door Ronald Boer : 31-10-2009 om 12:40 Reden: Automatisch samengevoegd.
Plaats een
- + Advertentie
- + Onderwerp
Marktplaats
Webmasterforum
- Websites algemeen
- Sitechecks
- Marketing
- Domeinen algemeen
- Waardebepaling
- CMS
- Wordpress
- Joomla
- Magento
- Google algemeen
- SEO
- Analytics
- Adsense
- Adwords
- HTML / XHTML
- CSS
- Programmeren
- PHP
- Javascript
- JQuery
- MySQL
- Ondernemen algemeen
- Belastingen
- Juridisch
- Grafisch ontwerp
- Hosting Algemeen
- Hardware Info
- Offtopic