logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Video Tutorials
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 05-05-2007, 11:23 PM   #1
Jbradshaw91
 
Join Date: May 2007
Location: New York
Posts: 13
Default if i post my code here do you think you could figure out whats wrong?

PHP Code:
<?php
require_once("Connections/connection.php"); // database connection
 
/////////////////////////
$query =sprintf("SELECT * FROM table1");
$result =@mysql_query($query);
$row =mysql_fetch_array($result);
 
 
echo 
$row["field2"];
 
 
?>

thats what i got what is wrong?
Jbradshaw91 is offline   Reply With Quote
Old 05-05-2007, 11:25 PM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

post the contents of the connection.php
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 05-05-2007, 11:31 PM   #3
Jbradshaw91
 
Join Date: May 2007
Location: New York
Posts: 13
Default

PHP Code:
<?php
// This is a database connection script //
$database "jbwd";
$username "Justin";
$password "yellow91";
//////////////////////////////////////////
 
$link = @mysql_connect("localhost"$username$password);
$db mysql_select_db ($database, &link);
 
?>
Jbradshaw91 is offline   Reply With Quote
Old 05-05-2007, 11:36 PM   #4
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

check your $link variable....

PHP Code:
$db mysql_select_db ($database, &link); 
its prefixed with an ampersand. Should be a dollar
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 05-05-2007, 11:39 PM   #5
Jbradshaw91
 
Join Date: May 2007
Location: New York
Posts: 13
Default

ok thanks mate ill give it a try
Jbradshaw91 is offline   Reply With Quote
Old 05-05-2007, 11:49 PM   #6
Jbradshaw91
 
Join Date: May 2007
Location: New York
Posts: 13
Default

ok did that and this is what happens now

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in G:\Documents and Settings\Justin\Local Root\Test\Connections\connection.php on line 9

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in G:\Documents and Settings\Justin\Local Root\Test\jbwd.php on line 7
Jbradshaw91 is offline   Reply With Quote
Old 05-05-2007, 11:52 PM   #7
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

thats ok

its just a warning which can be supressed by adding an @

PHP Code:
$db = @mysql_select_db ($database$link); //<< where you have this in your connection.php note the @ position 
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 09-04-2007, 06:35 AM   #8
Torin
Torin's Avatar
 
Join Date: Sep 2007
Posts: 29
Default

Isn't this post in the wrong forum? o.O
__________________
Torin's Blog: Click Here
Torin is offline   Reply With Quote
Reply


Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:42 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com