![]() |
Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
|
|
I'm prolly just retarded... but... |
Page: 1 2 | Reply |
Mar 28th 2002 | #37983 Report |
![]() Posts: 108 |
this is a news script i've been working on... [PHP]while($data=mysql_fetch_array($result))[/PHP] gives me Warning: Supplied argument is not a valid MySQL result resource in C:\Inetpub\HostedSites\TU Hosted Sites\hosted.tribes-universe.com\debig3\darkfolder\editnews.php on line 32 that error.. what is the correct syntax..... i'm missing it... if need be i'll post the whole thing but i'm hoping that someone will spot it right away |
Reply with Quote Reply |
Mar 28th 2002 | #37984 Report |
![]() Posts: 1452 |
Well, from that line of code, I see something missing. Unless it's down on the next line. But there should be a { after that. while($data=mysql_fetch_array($result)) { //whatever other code } |
Reply with Quote Reply |
Mar 29th 2002 | #37985 Report |
![]() Posts: 108 |
[PHP] require ("database.inc.php"); $result = mysql_query("SELECT subject,content,timestamp FROM news ORDER BY timestamp DESC"); while ($data = mysql_fetch_array ($result)) { ?> echo $data["subject"]; ?> [ echo date("d. m. Y", $data["timestamp"]) ?>] echo nl2br($data["content"]) ?> } ?>[/PHP] ^^ full thing... |
Reply with Quote Reply |
Mar 29th 2002 | #37987 Report |
![]() Posts: 108 |
database.inc.php = [PHP] $database_server="host"; //hostname of our database server $database_user="name"; //username $database_password="pass"; //password $database="news"; //database to select $db=mysql_connect($database_server, $database_user, $database_password); mysql_select_db($database); mysql_query("CREATE TABLE news (id int unsigned auto_increment, subject varchar(60) not null, content text not null, timestamp bigint unsigned not null, primary key(id), key(timestamp))"); ?> [/PHP] |
Reply with Quote Reply |
Mar 29th 2002 | #37988 Report |
![]() Posts: 108 |
sry for the messed up tables.... its big line of code.
|
Reply with Quote Reply |
Mar 29th 2002 | #37989 Report |
![]() Posts: 1452 |
I would edit these lines quickly: $database_user="xxxxxx"; //username $database_password="xxxxxx"; //password You dont want people here knowing how to get into your database. I'm still looking at the code. |
Reply with Quote Reply |
Mar 29th 2002 | #37990 Report |
![]() Posts: 108 |
already edited.... noticed it as soon as i posted.
|
Reply with Quote Reply |
Mar 29th 2002 | #37991 Report |
![]() Posts: 1452 |
heh, guess you were editing when I was replying. Try this: $sql = "SELECT subject,content,timestamp FROM news ORDER BY timestamp DESC"; $result = mysql_query($sql); $data = mysql_numrows($result); while($data = mysql_fetch_array($result)) { |
Reply with Quote Reply |
Mar 29th 2002 | #37993 Report |
![]() Posts: 108 |
$data = mysql_numrows($result); gives the error now.
|
Reply with Quote Reply |
Mar 29th 2002 | #37995 Report |
![]() Posts: 108 |
Warning: Supplied argument is not a valid MySQL result resource in C:\Inetpub\HostedSites\TU Hosted Sites\hosted.tribes-universe.com\debig3\doindex.php on line 10 Warning: Supplied argument is not a valid MySQL result resource in C:\Inetpub\HostedSites\TU Hosted Sites\hosted.tribes-universe.com\debig3\doindex.php on line 12 this error...... and line 12 is while($data = mysql_fetch_array($result)) |
Reply with Quote Reply |
Page: 1 2 | Back to top |
Please login or register above to post in this forum |
© Web Media Network Limited. All rights reserved. No part of this website may be reproduced without written permission. Photoshop is a registered trademark of Adobe Inc.. TeamPhotoshop.com is not associated in any way with Adobe, nor is an offical Photoshop website. |