PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Obadiah
Forum Regular
Posts: 580 Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:
Post
by Obadiah » Fri Sep 08, 2006 1:45 pm
say your pulling information from a mySQL database....and the name of the table is foobar....would you do something like this
or would it just be
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Fri Sep 08, 2006 1:48 pm
the second one
Mordred
DevNet Resident
Posts: 1579 Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria
Post
by Mordred » Fri Sep 08, 2006 2:05 pm
Code: Select all
$g_sFoobarTable = 'foobar';
//...
function Whateva() {
global $g_sFoobarTable;
$sql = "SELECT * FROM `$g_sFoobarTable`";
}
Obadiah
Forum Regular
Posts: 580 Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:
Post
by Obadiah » Fri Sep 08, 2006 2:15 pm
ok...i did this and my echo is not working at all
Code: Select all
<?php
session_start();
include("../../asdfr/kdsjfhkasdfk");
$table_name = "customer";
while($newArray = mysql_fetch_array($result)){
$user_name = $newArray['user_name'];
echo "Welcome $user_name to hell";
}
but it does place the username in the browser like its supposed to...but when i just log in regularly it doesnt....why?
Mordred
DevNet Resident
Posts: 1579 Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria
Post
by Mordred » Fri Sep 08, 2006 2:33 pm
Yeah, I can see what went wrong, it's all that code that you haven't posted
That, or you've misspelled "
kdsjfhkasdfk "
Obadiah
Forum Regular
Posts: 580 Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:
Post
by Obadiah » Fri Sep 08, 2006 2:46 pm
lol...sorry bout that m8 the other code is posted
here
[edited]
if you scroll to the bottom you can see what ive fixed and the problems im having at present
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Fri Sep 08, 2006 2:52 pm
To answer your original question, read Ninja's reply. As for the snippet of code you posted here in this thread, that tells us nothing. If this is in regards to your other thread, you should post those question in that thread instead of this to prevent possible lock-down of this thread as a double-post.