Ok..I got it to find the database and it return the values with an echo statement. How do I assign column names to variables? Thanks
Invalid query: Unknown column in 'field list'
You might also look at this...
$result=mysql_query($query);
Try
$result=mysql_query($query,$link);
so it knows what connection for the query...
$data=mysql_fetch_array($results);
$var1=$data[0];
$var2=$data[1];
etctra
you can also find out what your data offsets are by using this
echo('<pre>');
print_r($data);
echo('</pre>');
that will print out the first record of your array with all the offsets. the <pre> just makes it easier to read.
cbrknight - I appreciate you taking the time to help me with this. Unfortunately I'm very new to all of this. I'm trying to put together a "web portal" for a client to access and look at their accounts. I'm not very familiar with the language yet.
When I used this: echo $row['guarantor']; It worked just find.
Now I want to use the print command so that I can format and put the information exactly where I want it on the page. Or can I use the echo command above within html formatting to get the same result?
Thanks again...very much appreciated.
you can use echo $row['guarantor'];
or set
$guarantor = $row['guarantor'];
and use echo $guarantor;
I believe you can print also...
but I never us print so couldnt tell you the pros and cons of echo vs. print
as to html I would do it something like this
<tr>
<td>Guarantor Name: <?php echo $guarantor; ?> </td>
</tr>
or you can
echo('
<tr>
<td>Guarantor Name: $guarantor </td>
</tr>
')
With the second method all the html is processed through php and you have to be careful with your quotes
Thanks! Now that I see it, it's simple. Sometimes I make it harder than it should be. I'll give it a try and post my results.
I think I learn everthing in PHP the hard way... Good luck
Ok...one more quick question...where do I put, for example, $guarantor = $row['guarantor']; in the code?
anywhere after the mysql_fetch_array.... and before you echo it out....
That worked! You have no idea how much I appreciate your help. I've been fighting with this stuff for about 3 or 4 days. Slowly coming to understand though. Thanks Again.
No problem dont forget to Set link to RESOLVED