Activity Stream
48,167 MEMBERS
61303 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 9 of 9
  1.     
    #1
    Member

    Default mysql syntax error

    there's a syntax error in this mysql statement.. please help.. thanks a ton..

    $fetch_users_data = mysql_fetch_object(mysql_query("SELECT * FROM 'members' WHERE username=".$_SESSION['username'].""));

    ---------- Post added 16th Apr 2012 at 07:04 AM ---------- Previous post was 15th Apr 2012 at 11:38 AM ----------

    bump
    gamma Reviewed by gamma on . mysql syntax error there's a syntax error in this mysql statement.. please help.. thanks a ton.. $fetch_users_data = mysql_fetch_object(mysql_query("SELECT * FROM 'members' WHERE username=".$_SESSION."")); ---------- Post added 16th Apr 2012 at 07:04 AM ---------- Previous post was 15th Apr 2012 at 11:38 AM ---------- bump Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    please help me I keep getting this error: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/linksnap/public_html/includes.php

  4.     
    #3
    Member
    Instead of 1 big line, try to split it up, so you can identify the error better.

    PHP Code: 
    $username $_SESSION['username'];
    $mysqlquery mysql_query("SELECT * FROM members WHERE username='$username'");
    $fetch_users_data mysql_fetch_object($mysqlquery); 

  5.     
    #4
    Member
    Quote Originally Posted by Moggy View Post
    Instead of 1 big line, try to split it up, so you can identify the error better.

    PHP Code: 
    $username $_SESSION['username'];
    $mysqlquery mysql_query("SELECT * FROM members WHERE username='$username'");
    $fetch_users_data mysql_fetch_object($mysqlquery); 
    Thanks Moggy. But it gives the following error for the last line($fetch_users_data = mysql_fetch_object($mysqlquery)

    Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/jaggadak/public_html/includes.php on line 4

  6.     
    #5
    Member
    Website's:
    LulzCovers.com LulzTroll.com
    try this
    PHP Code: 
    $username $_SESSION['username'];
    echo 
    $username;
    $mysqlquery mysql_query("SELECT * FROM members WHERE username='" $username ."'");
    $fetch_users_data mysql_fetch_object($mysqlquery); 
    Contact me for Traffic, SEO, WCDDL, Wordpress, IPB related Services or queries.
    Template Designing, PSD to HTML, Wordpress


  7.     
    #6
    Member
    Website's:
    wscripts.net damnlolscript.com lulzjet.com
    try this:
    Code: 
    $username = $_SESSION['username'];
    $sql = mysql_query("SELECT * FROM members WHERE username='" . $username ."'") or die(mysql_error());
    $fetch_users_data = mysql_fetch_object($mysqlquery);
    will show the mysql error

  8.     
    #7
    Member
    Quote Originally Posted by deAthbLisS View Post
    try this
    PHP Code: 
    $username $_SESSION['username'];
    echo 
    $username;
    $mysqlquery mysql_query("SELECT * FROM members WHERE username='" $username ."'");
    $fetch_users_data mysql_fetch_object($mysqlquery); 
    Now it gives the error on line 5 ($fetch_users_data = mysql_fetch_object($mysqlquery);
    )

    I think the error is because of the function 'mysql_fetch_object' Any ideas?

  9.     
    #8
    Member
    No, i think the error is because the username is empty, try
    PHP Code: 
    $username $_SESSION['username']; 
    $mysqlquery mysql_query("SELECT * FROM members WHERE username='" $username ."'"); 
    if (
    $mysqlquery)
    $fetch_users_data mysql_fetch_object($mysqlquery);
    else
    die(
    "username=" $username " mysql error=" mysql_error()); 

  10.     
    #9
    Member
    Quote Originally Posted by Moggy View Post
    No, i think the error is because the username is empty, try
    PHP Code: 
    $username $_SESSION['username']; 
    $mysqlquery mysql_query("SELECT * FROM members WHERE username='" $username ."'"); 
    if (
    $mysqlquery)
    $fetch_users_data mysql_fetch_object($mysqlquery);
    else
    die(
    "username=" $username " mysql error=" mysql_error()); 
    Thanks a lot Moggy its working now love you

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Syntax Error
    By Qoo in forum Wordpress
    Replies: 0
    Last Post: 7th Jun 2012, 02:23 PM
  2. Database error-mysql error
    By saini in forum vBulletin
    Replies: 8
    Last Post: 8th Nov 2011, 06:54 AM
  3. MYSQL Error while Import via MYSQL Dumper (Error
    By desibreaker in forum Server Management
    Replies: 10
    Last Post: 5th Aug 2011, 07:26 PM
  4. MySQL Error!
    By jackiebi in forum Technical Help Desk Support
    Replies: 0
    Last Post: 22nd Jul 2011, 06:18 AM
  5. Syntax Error
    By Ryan in forum phpBB
    Replies: 3
    Last Post: 12th Feb 2009, 10:24 PM

Tags for this Thread

BE SOCIAL