[PHP] How to display field after MySQL join.

2002-12-25 Thread Stephen of Blank Canvas
Hi Everyone,
 
I'm trying to display the content of two mysql tables on a single page,
I have successfully joined them with the following statement.
 
$query = "SELECT serv.*, cat.* FROM site_services AS serv,
site_servicescat AS cat WHERE serv.servicescat_id = cat.servicescat_id
AND serv.theme_id = $DomainTheme AND serv.status = 1 ORDER BY RAND()
LIMIT 3";

This works great but my problem is I have a field in each table called
"title", if I use the normal function of $row[title] I get field from
the "site_services" table but I cannot work out how to get the
"site_servicescat" title field.  I have tried $row[cat.title] but all I
get is errors. 
 
Any help would be really appreciated as I think it's just me missing
something basic.
 
Thanks
 
Stephen



[PHP] include option and calling only part of a file.

2002-12-28 Thread Stephen of Blank Canvas
Hi Everyone,
 
I have one file with several sections of code which I have so far
accessed using a good old fashioned - - if ($HTTP_GET_VARS['action'] ==
"Update") - - however I now want to include this code within some other
web pages, I thought I may be able to use the following code  - -
include("/modules.php?action=Update") - - however the code does not run.
Hoping someone can help me out on a way to overcome this.  I am running
IIS 5, and PHP 4.2.3
 
Thanks
 
Stephen



[PHP] Setting session variables from a MySQL field value.

2003-01-15 Thread Stephen of Blank Canvas
Hi Everyone,
 
I'm trying to use MySQL to store some general settings for a site I am
working on, which I was then going to access as session variables on
pages as needed without having to call the dB each time.  However I am
having problems setting the name of the session variable in a way that I
can reference it later.  The code I am trying to use is:
 
===
   session_start();
   $connection =
@mysql_connect("$MySQLHost","$MySQLUser","$MySQLPassword") or
die("Unable to connect to MySQL Host. ".mysql_error() );
   $db = @mysql_select_db($MySQLdB, $connection) or die("Unable to
connect to MySQL dB. ".mysql_error() );
   $query = "SELECT * FROM config WHERE status = 1";
   $result = @mysql_query($query,$connection) or die("Unable to execute
select query. ".mysql_error() );
   $num_rows = mysql_numrows($result);
 
   while ($row = mysql_fetch_array($result))
   {
   $config_$row[config_id] = $row[config_value];
   session_register(config_$row[config_id]);
   }
 
   mysql_free_result($result);
   mysql_close($connection);
===
 
Any pointers much appreciated.
 
Stephen



[PHP] Does remote file(image) exist ?

2003-01-18 Thread Stephen of Blank Canvas
Hi Everyone,
 
Sorry I have no example code at all for this at all, I know some people
don't like that but I just do not know where to start so am asking for
help.
 
I have a system there users can put a picture of themselves by method of
URL in a MySQL field, however many of this image URL's do not work as
users type them in wrong.  So what I wanted to do was find a way to test
to see if the image can be accessed, then if not display a default
image.
 
Hope that makes sense, anyone already done something like this and want
to share code :-)
 
Stephen



[PHP] Detecting if GET field is Numeric or Alpha numeric

2003-03-18 Thread Stephen of Blank Canvas
Hi Everyone,

Does anyone know if it is possible to check the values of a $_GET field
and see if the submitted data is numeric or contains any letters.

What I want to do is allow users to link to a record in a MySQL db using
the record id's and the values of the name field.

www.domain.com/showlisting.php?town=1 and
www.domain.com/showlisting.php?town=London 

Both would work by performing a search on different fields in the MySQL
SELECT statement.  Just an idea to make thing easy for users, any help
appreciated.

Thanks

Stephen


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Variable Value 2 Session Name

2002-11-05 Thread Stephen of Blank Canvas Group
I'm trying to create what I believe should be a simple script to help
with logging users into my site.  My problem is that at  the top of my
script I set a variable with it's value and then at later script I
cannot appear to access it.
 
Extract of my code is as follows and fails:
 
$IDField = "loginemail";
$SessionUser = $row['.$IDFeild.'];
session_register('SessionUser');
 
However if I change the second line to

$SessionUser = $row['loginemail'];
 
It works great.
 
Any help would be really appreciated as I think it's just me missing
some basics.
 
Thanks
 
Stephen