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
Warning: mysql_num_rows(): supplied argument is not a valid MySQL
Old 11-05-2009, 10:09 AM Warning: mysql_num_rows(): supplied argument is not a valid MySQL
Novice Talker

Posts: 8
Name: Nur Syazwani
Trades: 0
please help me how to find the solution for the error above...below is showing my coding...

<?php
if (isset($_REQUEST["submit"]))
{
$Id=$_REQUEST['Id'];
$NAMA=$_REQUEST['NAMA'];
$NOMBOR_ID=$_REQUEST['NOMBOR_ID'];
$JURUSAN=$_REQUEST['JURUSAN'];

$dbhost="localhost";
$dbuser="root";
$dbpass="";
$db_name="jmti";

$connect = mysql_connect($dbhost,$dbuser,$dbpass);
$selectdb = mysql_select_db($db,$connect);
$checkid = mysql_query("select * from daftar where NAMA = '$NAMA'");

if(mysql_num_rows($checkid)==0)
{$save = "insert into daftar(Id,NAMA,NOMBOR_ID,JURUSAN) values
('$Id','$NAMA','$NOMBOR_ID','$JURUSAN')";

mysql_query($save) or die ("query error!");
echo "<p>Thank you for using our service, <b>$NAME</b>,your are choosed JURUSAN <b>$JURUSAN</b>";
}
else
echo"<br>Duplicate Food ID";
}
?>

please help me..
syaza is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-05-2009, 10:48 AM Re: Warning: mysql_num_rows(): supplied argument is not a valid MySQL
Ultra Talker

Posts: 339
Trades: 0
Do you get the same error if you query select * from daftar where NAMA = '$NAMA'" is launched via phpmyadmin directly?

Do you really use correct table/field names?
__________________
Daniel, Helpdesk Leader

Please login or register to view this content. Registration is FREE
- First class web hosting services.

Please login or register to view this content. Registration is FREE
- Provide unlimited disk space and bandwidth!
Hosting24 is offline
Reply With Quote
View Public Profile
 
Old 11-05-2009, 12:49 PM Re: Warning: mysql_num_rows(): supplied argument is not a valid MySQL
Novice Talker

Posts: 8
Name: Nur Syazwani
Trades: 0
YUP...i use the correct table n field...My table's name is daftar and their fields are NAMA and JURUSAN...
syaza is offline
Reply With Quote
View Public Profile
 
Old 11-05-2009, 12:53 PM Re: Warning: mysql_num_rows(): supplied argument is not a valid MySQL
Skilled Talker

Posts: 80
Name: John
Location: Sacramento
Trades: 0
Try:

PHP Code:
$connect mysql_connect($dbhost,$dbuser,$dbpass);
if (!
$connect) {die('Failed to connect to Server! - '.mysql_error());}

$selectdb mysql_select_db($db,$connect);
if (!
$selectdb) {die('Failed to connect to DB! - '.mysql_error());}

    
$checkid mysql_query("select * from daftar where NAMA = '$NAMA'");
if (!
$checkid) {die('Failed to execute query! - '.mysql_error());} 
This way you can better troubleshoot.
Envision_frodo is offline
Reply With Quote
View Public Profile
 
Old 11-05-2009, 02:22 PM Re: Warning: mysql_num_rows(): supplied argument is not a valid MySQL
Novice Talker

Posts: 8
Name: Nur Syazwani
Trades: 0
T.Q...i will try.....
syaza is offline
Reply With Quote
View Public Profile
 
Old 11-09-2009, 04:26 AM Re: Warning: mysql_num_rows(): supplied argument is not a valid MySQL
Ultra Talker

Posts: 339
Trades: 0
Any good news?
__________________
Daniel, Helpdesk Leader

Please login or register to view this content. Registration is FREE
- First class web hosting services.

Please login or register to view this content. Registration is FREE
- Provide unlimited disk space and bandwidth!
Hosting24 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Warning: mysql_num_rows(): supplied argument is not a valid MySQL
 

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