MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 21st, 2013, 08:05 AM
Chun Ming Chun Ming is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2013
Posts: 1 Chun Ming User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 8 sec
Reputation Power: 0
Help! alreays get wrong for check

Dear All,

I am going to check the input is equal to/exist in table ,however. i use select where and msquery_num_rows always get error. Can someone help me?

<?php
$con=mysqli_connect("127.0.0.1","root","19990116","coursedb");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$courseno= '$_POST[courseno]';

$coursecmp = mysqli_query($con,"SELECT * FROM coursetbl
WHERE courseno=$_POST[courseno]");

$num = mysql_num_rows($coursecmp);

if($num >0)
{
echo "strings are equal";


$sql="INSERT INTO applytbl (applyno, name, stid, hkid, email, tel)
VALUES
('$_POST[courseno]','$_POST[name]','$_POST[stid]','$_POST[hkid]','$_POST[email]','$_POST[tel]')";

if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo "1 record added";

mysqli_close($con);

}

else
{
echo "The course is not existed.";
}

?>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Help! alreays get wrong for check


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap