Member Avatar

Hi there, I have a problam with my code, and i cant fix it, please help. The problam is with the mysql_num_rows on line 4 ; Here is the code: $sql_query = mysql_query("SELECT * FROM upload WHERE MATCH(username,text) AGAINST('$search_term')"); //additional check. Insurance method to re-search the database again in case of too many matches (too many matches cause returning of 0 results) if($results = mysql_num_rows($sql_query) != 0) //Error on this line !!!! { $sql = "SELECT * FROM upload WHERE MATCH(username,subject) AGAINST('$search_term') LIMIT $first_pos, $RESULTS_LIMIT"; $sql_result_query = mysql_query($sql); } Thanks for your help!

Member Avatar
0
40
Member Avatar

i have this problem for checking for duplicate username in database. this error appear whether the username is duplicate and does not duplicate. Please help. Warning: mysql_num_rows() expects parameter 1 to be resource, boolean in <?php include_once 'db/db.php'; include_once 'admin-class.php'; $admin = new itg_admin(); if(isset($_POST['Submit'])) { $con = mysql_connect("localhost","username","password","tablename"); if (!$con) { die('Could not connect: ' . mysql_error()); } //---Encrypt ---// $confirmcode=md5(uniqid(rand())); $password=md5($_POST['password']); //---Insert value to table---// mysql_select_db( 'tablename' ); $getduplicates = mysql_query("SELECT * FROM users WHERE username =$_POST[username]"); $duplicates = mysql_num_rows($getduplicates); if($duplicates){ echo "Username has been used.Please choose another username"; ?> <script type="text/javascript"> alert("Username has been used.Please choose another …

Member Avatar
0
5
Member Avatar

data does not come at phpmysqladmin. and also shows this warning Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\com\com.php on line 75 Thank you for submission [CODE]<?php if ( isset($_POST['username'])) { $ret = add_to_database(); if (!$ret) { print "Error: Database error"; } else { print "Thank you for submission"; } } else { write_form(); } //functions function write_form() { $self =$_SERVER['PHP_SELF']; echo <<<EOT <form action="$self" method="POST"> <table> <tr> <td>User Name:</td> <td><input type="text" name="username" /></td><br/> </tr> <tr> <td>E-mail:</td> <td><input type="text" name="useremail" /></td><br/> </tr> <tr> <td>Comment:</td> <textarea cols="50" rows="8" wrap="VIRTUAL" name="comment"></textarea> </tr> <tr> <td>&nbsp</td> <td><input type="submit" /></td> </tr> …

Member Avatar
0
19
Member Avatar

am geting this error while testing the login panel of my website that am currently developing. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/smartie1/public_html/checklog.php on line 43 which is in red this is the php script used for login <?php session_start(); function session_defaults() { $_SESSION['logged'] = false; $_SESSION['uid'] = 0; $_SESSION['username'] = ''; $_SESSION['cookie'] = 0; $_SESSION['remember'] = false; } if (!isset($_SESSION['uid']) ) { session_defaults(); } $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="XXXXXX[CODE][/CODE]"; // Database name $tbl_name="Customer_Infor"; // Table name // Connect to server and select databse. $con = …

Member Avatar
0
5

The End.