SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help, SQL query result error

    Code PHP:
    <?php 
    ini_set('display_errors',1); 
    error_reporting(E_ALL); 
    $link = mysqli_connect('localhost', 'root', 'root');
    if (isset($link))
    {echo "Link successfully established";}
     
    mysqli_select_db($link, 'Inventory')
    	$result = mysqli_query($link,  'SELECT StockId , StockItem FROM StockMaster');
     
    	while ($row = mysqli_fetch_array($result))
    	{
    		$StockItems[] = array('id' => $row['StockId'], 'name' => $row['StockItem']);
    	}
    ?>
    When I load the file, the following error is displayed:
    Parse error: syntax error, unexpected T_VARIABLE in K:\UwAmp\www\Inventory\stockinwards0.php on line 9
    Line 9 in the text editor is the line beginning with $result above.

    Thanks in advance for the help.

    Regards,
    Rajendra

  2. #2
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rspai View Post
    Code PHP:
    <?php 
    ini_set('display_errors',1); 
    error_reporting(E_ALL); 
    $link = mysqli_connect('localhost', 'root', 'root');
    if (isset($link))
    {echo "Link successfully established";}
     
    mysqli_select_db($link, 'Inventory')
    	$result = mysqli_query($link,  'SELECT StockId , StockItem FROM StockMaster');
     
    	while ($row = mysqli_fetch_array($result))
    	{
    		$StockItems[] = array('id' => $row['StockId'], 'name' => $row['StockItem']);
    	}
    ?>
    When I load the file, the following error is displayed:
    Parse error: syntax error, unexpected T_VARIABLE in K:\UwAmp\www\Inventory\stockinwards0.php on line 9
    Line 9 in the text editor is the line beginning with $result above.

    Thanks in advance for the help.

    Regards,
    Rajendra
    I think you missed the semicolon at the end of the line: mysqli_select_db($link, 'Inventory')

    Cheers

    Wing

  3. #3
    SitePoint Member
    Join Date
    Dec 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, Wing. You were right.

    Regards,
    Rajendra

  4. #4
    Non-Member
    Join Date
    Dec 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sometimes SQL create problems to give result to the queries. You can recover these type of problems by reinstalling SQL again.

  5. #5
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    65 Post(s)
    Tagged
    0 Thread(s)
    This wasnt actually a problem with the SQL, but the PHP. And... really it would be -very- rare that you would need to reinstall the SQL daemon, so i'm not sure what you're referring to (or if you're just spam).

    This error is covered under the Common PHP Problems sticky at the top of the forum, btw.
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •