Jump to content

Recommended Posts

Hi I wanted to know how I would get info from a specific cell? I've searched the forums with no luck, I know this is a noob question. I thought it would be something like this:

 

$account = mysql_fetch_array(mysql_query("SELECT * FROM adverts WHERE username='$username' AND id='$id'"));

 

but what does all this mean? adverts is the table? The login script I am using is this one:

 

http://www.evolt.org/article/comment/17/60265/index.html

 

Any help would be greatly appreciatied!

@how I would get info from a specific cell?

- what do you mean? you can add a "WHERE " in your query..

- use mysql_fetch_array to get all the matched record in your where clause..

 

i cant find that code in the url you gave..

 

Hi I wanted to know how I would get info from a specific cell? I've searched the forums with no luck, I know this is a noob question. I thought it would be something like this:

 

$account = mysql_fetch_array(mysql_query("SELECT * FROM adverts WHERE username='$username' AND id='$id'"));

 

but what does all this mean? adverts is the table? The login script I am using is this one:

 

http://www.evolt.org/article/comment/17/60265/index.html

 

Any help would be greatly appreciatied!

 

That's poor and sloppy code for querying the database for an entire row(s) from your database where the username and id in the row equal $username and $id and then putting the results into an array $account. Since mysql_fetch_array isn't looped, even if there's more than 1 row returned, $account will only have the first row in the list returned.

 

To access the info returned, you would do for instance

 

echo $account['username']; // echoes the username

echo $account['id']; // echoes the id

echo $account['columnname']; // replace columnname with whatever other column is in your table

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.