Re: [PHP-DB] terminates string?

2005-01-06 Thread Gabino Travassos
Hey Matthew
Example: index..php?id=4539page=dest.phpwig=top
From this url example I can use the following variables:
$id='4539';
$page='dest.php';
$wig='top';
for ampersands, use %26
the same way that spaces are %20 in URLs
So, if I wanted to pass a variable that had an ampersand in it, like Tony  
Tina's Wedding
page=Tony%20%26%20Tina%27s%20Wedding

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


Re: [PHP-DB] PHP / Javascript question

2004-11-15 Thread Gabino Travassos
Hi there everyone,
I have a form with check boxes and with PHP I use the array feature for the
form name.  Now I need to check if the tickboxes are ticked and if not
return an error, normally with javascript I would use:
script language=JavaScript
function validate_form ( )
{  valid = true;
if ( document.removeitems.del.value ==  ){
   alert ( You cannot remove an item if it is not selected. );
   valid = false;  }
   return valid; }
/script
BUT because the tickboxes information is stored in a PHP Array called del[]
I am having major problems getting it to work.  Does anyone know how to
determine with javascript if any boxes are ticked, when the name for the box
is an Array such as del[] ???  Im grabbing the data from my MySQL DB
without a hitch etc . And I know technically this is more MySQL / PHP list,
but it is related and Ive looked online and cant seem to find anything, so
thought Id try here as usually you are all very helpful.
Thank you
Chris
+
Hey Chris
So, PHP creates HTML and Javascript on the server end. Javascript is read in 
the browser. By the time the Javascript gets to do checks to see whether a 
box is pressed or not, the PHP array is long-gone.

You should run your PHP, and then check the source code it makes in the 
browser. What you'll hopefully see is a bunch of form boxes with the names 
they got from the array. So, use Javascript to check those names.

If your list is dynamic, so there might be del1, del2, del3, etc., you'll 
want to use a loop in Javascript to run through the names. To find out how 
many there are for the loop, PHP can dump a javascript variable called 
loopAmount or something.

Luck.
Gabino 

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


Re: [PHP-DB] Fixing this code to show all variables!

2004-11-01 Thread Gabino Travassos
Hello Juan
If I declare Telefono=4141414 in one line and in the next line I declare 
Telefono=31453531, then I have overwritten the first variable.

What you need to change is the name of the variable. You need to append your 
ID number to the variable name.

So Telefono01=4141414 and Telefono02=31453531 will be two differently 
named variables.

Luck
Gabino 

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


Re: [PHP-DB] Books

2004-10-18 Thread Gabino Travassos
I like PHP Functions: Essential Reference from New Riders. It's pretty much 
redundant to the online manual: http://www.php.net/manual/en/ , but I can 
read it waiting for my bus. It's $50 US though.

The O'Reilly book Web Database Applications with PHP and mySQL is also 
handy. http://www.oreilly.com/catalog/webdbapps2/


- Original Message - 
From: Huy Ton That [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, October 18, 2004 11:19 AM
Subject: [PHP-DB] Books


Can anyone recommend me any good books that they return to for both
information learning PHP  maybe MySQL and/or reference?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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


Re: [PHP-DB] Showing all mysql query results!

2004-10-18 Thread Gabino Travassos
Have you used Flash to get PHP before? It looks like you're making your 
variables fine, but are you using a loop to check whether the variables have 
loaded? After Donde=$donde I would add a variable: done=1, then check in 
Flash whether done==1. If it is, all your variables have loaded into Flash, 
if not then you have to loop and wait. It doesn't happen instantaneously. It 
takes maybe 1/5 or 1/2 a second, so...


- Original Message - 
From: Norland, Martin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, October 18, 2004 12:45 PM
Subject: RE: [PHP-DB] Showing all mysql query results!


No, sorry - I haven't ever had to use flash, let alone use it to interface 
to php.

Check which result flash is seeing - is it only seeing the first, or is it 
only seeing the last?  It looks like you're building a query string to 
pass to it, but you're not presently setting the data as arrays (e.g. 
Apellido[]={$row['appellidoclientesnuevos']}) - which would mean it 
only gets to see one result set.

However, you don't want to be passing the entire results of your database 
query in a $_GET string to this flash script - if that is what you're 
doing - there is certainly a better/preferred way to get this info into 
flash.

- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

-Original Message-
From: Juan Stiller [mailto:[EMAIL PROTECTED]
Sent: Monday, October 18, 2004 1:25 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Showing all mysql query results!
Ok, i just followed your advice for make the code
easier to read, it looks good, and yes it works ok
too.
I´ve tried it, and yes it shows more than 1 entry, but
i cant make flash to show them, im sure something on
flash must be wrong or missing, there is no fault on
the php code, so i might research a little more on the
flash part.
Do you know some good tutorial for this?
Thanks for your response.
Juan.
--- Norland, Martin [EMAIL PROTECTED]
escribió:
A quick glance says that's all perfectly right, I
would run the query on the mysql command line to be
sure it's really giving more than 1 result - but I
can suggest two things:
1) be sure to mysql_free_result($result) afterwards
if you're done with the query but your script will
still be doing anything. You really do want to do
that because it tells mysql you're done with that so
it can release the memory - PHP doesn't actually use
the memory for that resultset, it just holds a
result id that it uses to get the results from mysql
(so best to let mysql have its memory back as soon
as you're done).
2) you will save yourself a fair amount of effort
and readability, if you don't need those variables
other than to print, to change things like so:
---
$apellido=$row[apellidoclientesnuevos];
echo Apellido=$apellido;
--- becomes ---
echo Apellido={$row['appellidoclientesnuevos']};
---
(you don't need to use ',  works too - I find '
more legible here)
This may also reduce confusion if you start thinking
that the database field is holding just names,
instead of names of new clients (e.g. you
accidentally paste it elsewhere for use and keep
pulling only from the new clients table).
Are you perhaps storing clients in that table
temporarily, so it rarely has many clients in it?
That could explain the behaviour as well.
- Martin Norland, Database / Web Developer,
International Outreach x3257
The opinion(s) contained within this email do not
necessarily represent those of St. Jude Children's
Research Hospital.
-Original Message-
From: Juan Stiller [mailto:[EMAIL PROTECTED]
Sent: Monday, October 18, 2004 11:07 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Showing all mysql query results!
Hi, im using this script, to show all entrys of a
mysql database on a flash movieclip, but i was told
at
flash forums, that this code is not ok, because its
showing only the last entry not all of them, maybe
you
someone can recommend what to add to this little
script?.
?php
$conn = @mysql_connect(***, ***, );
if (!$conn) {
echo( PNo se pudo conectar  .
al servidor MySQL./P );
exit();
}
if (! @mysql_select_db(clientes) ) {
echo( PNo se puede encontrar  .
la base de datos clientes!/P );
exit();
}
// Request all data
$result1 = mysql_query(select * from
clientesnuevos);
print Results=;
echo h1Clientes agregados:/h1br;
while($row=mysql_fetch_array($result1, MYSQL_ASSOC))
{
$id=$row[id];
echo Id=$id;
$apellido=$row[apellidoclientesnuevos];
echo Apellido=$apellido;
$nombre=$row[nombreclientesnuevos];
echo Nombre=$nombre;
$dni=$row[dniclientesnuevos];
echo Dni=$dni;
$telefono=$row[telefonoclientesnuevos];
echo Telefono=$telefono;
$dia=$row[diacitaclientesnuevos];
echo Dia=$dia;
$mes=$row[mescitaclientesnuevos];
echo Mes=$mes;
$ano=$row[anocitaclientesnuevos];
echo Ano=$ano;
$hora=$row[horacitaclientesnuevos];
echo Hora=$hora;
$minutos=$row[minutoscitaclientesnuevos];