Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.

Closed Thread
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 03-06-2012, 04:02 PM
Latest Blog:

Join Date: 07-03-11
Posts: 37
iTrader: 0 / 0%
Post variables in mysql_query failing

This works:
$result = mysql_query("SELECT * FROM mydatabase WHERE username = 'billybob'");

This does not:
$user = "billybob"
$result = mysql_query("SELECT * FROM mydatabase WHERE username = $user");

The second results in this error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource

Doh. Forgot I was passing a string. Fixed it myself.

Last edited by Mavent; 03-06-2012 at 04:09 PM.
Go Back   Webmaster Forum > Web Development > Coding Forum

Closed Thread

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
php: long variables with other variables which needs to be sent by email imadam Coding Forum 1 09-27-2011 06:14 PM
Why Microsoft Is Failing Amy Plott Tech Talk 23 03-25-2010 12:19 PM
Javascript post variables... jg_v7n Coding Forum 11 01-27-2010 11:58 AM
Why Am I Failing So Bad Help Me simplelance.com Marketing Forum 17 05-01-2006 09:25 PM

V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory

All times are GMT -7. The time now is 04:55 PM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2014 Escalate Media

Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.