Ask a Question related to PHP Development, Design and Development.
-
Noel Ferguson #1
Re: newbie php MySQL table question
Thanks to you both guys. As for reading the manual - I have 4 in front of me
and couldn't find the answer to my problem. Some things you do find, some
things you dont, and typically the thing you don't find are usually staring
you in the face! As for learning all this PHY and MySQL stuff, it aint so
much reading the manual cover to cover, but dipping in and out at the
sections you need. I'll underatdn it all one day.... I Hope!
Thanks again to you both!
Noel
"Zac Hester" <news@planetzac.net> wrote in message
news:3f1c7b1b$1@news.enetis.net...tell> "Noel Ferguson" <ferguson@consulting.club24.co.uk> wrote in message
> news:bfh7sn$jm6$2@titan.btinternet.com...> > Rather than state a table name in an MySQL query can someone pleasseFULL_NAME_ND> me> the> > whether I can use a variable to define the table name and if so what is> > correct statement e.g.
> >
> > instead of
> >
> > $sql = "SELECT * FROM uk WHERE Feature_Classification='P' ANDto> AND> > LIKE '$town'";
> >
> > have something like
> >
> > $sql = "SELECT * FROM $Primary_country WHERE Feature_Classification='P'>> > FULL_NAME_ND LIKE '$town'";
> >
> > Thanks
> > Noel Ferguson
> Hey Noel,
>
> Marcus answered your question perfectly, but I thought it might help youstring.> know that the query you send to the mysql_query() function is just ayou> It is absolutely no different than any other string you use in PHP. All
> string functions and properties work without any limitation. Therefore,all> can create the string using concatenation, regular expressions, loops, or
> whatever:
>
> $q = 'select * from some_table where';
> $criteria = array('lastname' => 'Johnson', 'firstname' => 'Bob', 'age' =>
> '35');
> foreach($criteria as $key => $val) {
> $q .= " $key = '$val' and ";
> }
> $q = substr($q, -5);
> mysql_query($q);
>
> I hate to say it so much, but if you had read the PHP manual, you'd know> of this.
>
> HTH,
> Zac
>
>
Noel Ferguson Guest
-
newbie question with php and mysql
Hi Everyone. Can someone suggest an approach for me please. I have a dynamic site where i want to display 3 random 'featured' records at different... -
Newbie Question: Table in Flash
Hi, I'd like to know the best way to create a table that can incorporate flash symbols. That is, I want to place flash symbols alongside data... -
newbie question: using DBI, DBI::mysql
Could you please explain this further? I'm not sure what I'm supposed to do here. My /etc/my.cnf file reads: host=mysql.addr.com I've tried... -
newbie question. how to assign an array to a hash table?
Hi, I have something like: $value = 'A' 'C' 'G'; and I would like store this value on a hash table. my @value = split(' ',$value); print... -
newbie : trying to count records in mysql table
Help, I get no output on this code // Connect to database. $dbh = mysql_connect("localhost","user","password"); mysql_select_db("survey"); ...



Reply With Quote

