What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » PHP help please

PHP help please
Author: Message:
jren207
Senior Member
****

Avatar
JR! - We <3 Fanta

Posts: 870
Reputation: 28
35 / Male / –
Joined: Sep 2003
RE: PHP help please
I was bored and made this little function. It only really works for getting info from one row of a table that you specify the id or whatever from the $_GET['uname'] part. (I was testing it on a users table). You specifiy the table name and the field you want, db_q('tablename', 'fieldname'); when you use the function

i'm sorta newb, blah :P

code:
<?php

// db function
function db_q($table, $field){

// get variable
$get_name = $_GET['uname'];

// db query
$db_query = mysql_query("SELECT * FROM $table WHERE id = $get_name");

// db fetch array
while($query_row = mysql_fetch_array($db_query)){

// query result
$query_result = $query_row[$field];
}

// return result
return $query_result;
}

// using the function

// echo html table part
echo('<table border="1">
<tr>
<td>
');
// run function
$display_result = db_q('users', 'username');
// echo result from function returned
echo('' . $display_result . '');
// echo html table bit
echo('
</td>
<td>
');

// run function with another table field used
$display_result = db_q('users', 'website');

// echo this field's result
echo('' . $display_result . '');

// echo end of html table
echo('
</td>
</tr>
</table>
');
?>

07-04-2005 12:09 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
PHP help please - by Ezra on 07-03-2005 at 04:25 PM
RE: PHP help please - by Eljay on 07-03-2005 at 04:31 PM
RE: PHP help please - by Ezra on 07-03-2005 at 04:39 PM
RE: PHP help please - by Dempsey on 07-03-2005 at 06:02 PM
RE: PHP help please - by Fourjays on 07-03-2005 at 10:36 PM
RE: PHP help please - by jren207 on 07-04-2005 at 12:09 AM
RE: PHP help please - by Ezra on 07-04-2005 at 01:44 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On