Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Junior Member
    Join Date
    Jun 2003
    Posts
    3
    Member #
    1682
    Hey everyone! This is my first post on this forum. I like it so far, and I will stick around!

    Anyway, I am trying to make a PHP script, and trying to connect to a MySQL database

    PHP Code:
    $link mysql_connect("localhost""(User name Deleted)""(Password Deleted)")
            or die(
    "Could not connect: " mysql_error());
    mysql_select_db("(database name deleted)");
    $link->query("SELECT id, name, date, username, description, source, image FROM news ORDER BY date");
    while( 
    $row mysql_fetch_array($blah)) 
    It returns some error about making a call to an undefined function called "query". What should I fix in my code?

    Thank you!

    Edit: To whoever runs this forum, I am sorry if this is off topic, but what host are you using? It seems very fast despite that you have many users online. I haven't set up a host yet and I'd like to take a look at whichever this site is using.

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    $link isn't an object, it's a handle to the connection. Just use mysql_query.

    http://www.hostingmatters.com/ is what we use.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    Junior Member
    Join Date
    Jun 2003
    Posts
    3
    Member #
    1682
    Thank you Filburt1, I will check them out.

    So should I put "mysql_query" in place of "query"? Thanks! :alien:

  5. #4
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Well, mysql_query in the place of $link->query.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  6. #5
    Junior Member
    Join Date
    Jun 2003
    Posts
    3
    Member #
    1682
    OK, works now!

    Thank you Heartless Dictator (and admin), I will see you around....what a site you have here

  7. #6
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    welcome to the board julbio...

    i actually think it should go something like this...

    PHP Code:
    $link mysql_connect("localhost""(User name Deleted)""(Password Deleted)")
            or die(
    "Could not connect: " mysql_error());
    mysql_select_db("(database name deleted)");
    $blah mysql_query("SELECT id, name, date, username, description, source, image FROM news ORDER BY date");
    while( 
    $row mysql_fetch_array($blah)) 
    notice i added $blah = so the $row variable is actually getting the data from the query.
    JR


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:42 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com