another query question

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

Post Reply
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

another query question

Post by Obadiah »

say your pulling information from a mySQL database....and the name of the table is foobar....would you do something like this

Code: Select all

$sql="SELECT * FROM foobarTable";
or would it just be

Code: Select all

$sql="SELECT * FROM foobar";
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

the second one
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Post by Mordred »

Code: Select all

$g_sFoobarTable = 'foobar';

//...

function Whateva() {
   global $g_sFoobarTable;
   $sql = "SELECT * FROM `$g_sFoobarTable`";
}
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

Post by Obadiah »

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?
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Post by Mordred »

Yeah, I can see what went wrong, it's all that code that you haven't posted :)
That, or you've misspelled "kdsjfhkasdfk"
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

Post by Obadiah »

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
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

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.
Post Reply