Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
MySQL and PHP trouble
Old 03-13-2008, 11:18 PM MySQL and PHP trouble
Junior Talker

Posts: 2
Name: Ryan Tomlinson
Trades: 0
This codes third line is give an error message on all pages of my web site.

<?
$sql = "SELECT * FROM tb_config WHERE item='click' and howmany='1'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
?>


The error message says the following

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/moneybux/public_html/index.php on line (number of line on page)

Can someone help me out to resolve this issue please.
moneybux is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-13-2008, 11:23 PM Re: MySQL and PHP trouble
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Just checking.. is howmany an actual column in your table or is that how many results you want? LIMIT is the mysql syntax for specifying the maximum number of results.
PHP Code:
$sql 'SELECT * FROM `tb_config` WHERE item = \'click\' LIMIT 1;'
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 03-13-2008, 11:27 PM Re: MySQL and PHP trouble
Junior Talker

Posts: 2
Name: Ryan Tomlinson
Trades: 0
I don't see 'howmany' in the table anywhere.
moneybux is offline
Reply With Quote
View Public Profile
 
Old 03-14-2008, 12:03 AM Re: MySQL and PHP trouble
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Well as the error is telling you. There is something wrong with you sql query. If there is no howmany column in your table then that's probably it. Try the query I gave you in place of the one you are using.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 03-14-2008, 12:12 AM Re: MySQL and PHP trouble
Novice Talker

Posts: 11
Trades: 0
Try to
$sql = "SELECT * FROM `tb_config` WHERE `item`='click' and howmany='1'";
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
iway is offline
Reply With Quote
View Public Profile
 
Old 03-14-2008, 06:35 AM Re: MySQL and PHP trouble
Skilled Talker

Posts: 59
Name: Dan
Trades: 0
If howmany is an int type it probably doesn't need to be in inverted commas

i.e.
SELECT * FROM tb_config WHERE item='click' and howmany=1
__________________

Please login or register to view this content. Registration is FREE

Nuts to that I just want to
Please login or register to view this content. Registration is FREE
Monkey Do is offline
Reply With Quote
View Public Profile
 
Old 03-14-2008, 07:37 AM Re: MySQL and PHP trouble
kids's Avatar
Ultra Talker

Posts: 301
Trades: 0
Quote:
Originally Posted by Monkey Do View Post
If howmany is an int type it probably doesn't need to be in inverted commas

i.e.
SELECT * FROM tb_config WHERE item='click' and howmany=1
Exactly!
PHP Code:
$sql"SELECT * FROM tb_config WHERE item='click' and howmany=1"
... 
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
kids is offline
Reply With Quote
View Public Profile Visit kids's homepage!
 
Reply     « Reply to MySQL and PHP trouble
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
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.38941 seconds with 12 queries