Reply
MySQL not showing on PHP scirpt!?
Old 05-10-2007, 08:53 AM MySQL not showing on PHP scirpt!?
The PHP Professor

Posts: 308
Name: Alex
Location: Behind You
I have created a small content management script(took about an hour), and the script allows you to create pages with all the content stored in a MySQL Database. So when you access "page.php?page=243" you get the page with the id "243"(just an example). And if you go to the list page, "page.php?page=list" you get a complete list of all the rows in the database.

For some wierd reason the first table in the MySQL databse will not display. i have created scripts in the past that list all the rows in the table but i dont know what is wrong. i have never come across this problem before. what can i do??


Also i need a little help with "Paginition" thing. the thing that looks sort of like:

Prev | 1 | 2 | 3 | ... | 120 | 121 | 122 | Last
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
Need a FILE host? Nobody gets it done right like 1Stopupload.com!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
When You Register, These Ads Go Away!
Old 05-10-2007, 09:18 AM Re: MySQL not showing on PHP scirpt!?
solomongaby's Avatar
Webmaster Talker

Latest Blog Post:
How Do You Find Music Online ?
Posts: 522
Name: Gabe Solomon
Location: Romania
my magic glass orb is not working so you will need to post you're code

as far as paginations goes ...my friend google was helpfull
http://www.google.ro/search?hl=ro&q=...e+Google&meta=
http://www.phpfreaks.com/tutorials/43/0.php
http://www.tutorialized.com/tutorial...-with-PHP/6925
__________________
If you like my posts ... TK is appreciated:)
Web Directory | Blog
solomongaby is offline
Reply With Quote
View Public Profile Visit solomongaby's homepage!
 
Old 05-10-2007, 09:36 AM Re: MySQL not showing on PHP scirpt!?
Republikin's Avatar
Super Moderator

Posts: 3,191
Please post your code.

My best guess without seeing the code is that your using a for loop based upon a starting value of 1 rather than 0.
Republikin is offline
Reply With Quote
View Public Profile
 
Old 05-12-2007, 03:10 AM Re: MySQL not showing on PHP scirpt!?
The PHP Professor

Posts: 308
Name: Alex
Location: Behind You
heres code, its modified, but still wont show first row:


PHP Code:
<?php
//
//request all the include files needed for this script
include "/includes/config.inc.php";
//
//only show them the list of pages if they request it
if($_GET['page'] == 'list') {
//
//check the database connection
mysql_connect($host$user_name$password)
   or die(
'Could not connect: ' mysql_error());
//
//select database
mysql_select_db($database_name) or die('Could not select database');
//
//query the table and fetch arrays
$result mysql_query("SELECT * FROM pages") or die(mysql_error()); 
$row mysql_fetch_array$result );
//
//display list
echo "List of pages in database:<br><br>";
//
//include the "while" so the entire page does not repeat
while($row mysql_fetch_array$result )) {
echo 
"<font size='-1'><a class='b' href='page.php?page=" $row['pageid'] . "'>" $row['pagetitle'] . "</a><br>Description: " $row['pagedescription'] . "...</font><br><br>"; }
echo 
"";
exit; }
?>
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
Need a FILE host? Nobody gets it done right like 1Stopupload.com!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
Old 05-12-2007, 09:32 AM Re: MySQL not showing on PHP scirpt!?
Republikin's Avatar
Super Moderator

Posts: 3,191
I'm just guessing here but...

Try only assigning $row once (the second time in the while loop is all that is needed). Also, try using mysql_fetch_assoc (or mysql_fetch_array($result, ASSOC)).
Republikin is offline
Reply With Quote
View Public Profile
 
Old 05-12-2007, 07:37 PM Re: MySQL not showing on PHP scirpt!?
The PHP Professor

Posts: 308
Name: Alex
Location: Behind You
No, those don't work but thanks.
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
Need a FILE host? Nobody gets it done right like 1Stopupload.com!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
Old 05-12-2007, 08:16 PM Re: MySQL not showing on PHP scirpt!?
Republikin's Avatar
Super Moderator

Posts: 3,191
Regardless, you should remove that first instance as it's unnecessary and just taking up processing power. As well, you should specify at least one of the result types since as it is right now it returns both a numerically indexed array and an associatively (is that a word?) indexed array. Since you only seem to be using the associative array I would recommend declaring MYSQL_ASSOC (yes I know, I was wrong earlier with just ASSOC).

Furthermore, would you be kind enough to provide a dump of your database (just the pages table) if the data isn't too sensitive. This way I can see which result is causing problems (a small chance that a malformed character or some other nonsense is causing trouble). My instinct is telling me though that it has something to do with your server environment though. Either way, I can see if I can reproduce it.
Republikin is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to MySQL not showing on PHP scirpt!?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14846 seconds with 12 queries