Re: [PHP-DB] Changing this php code to show multiple variables!
Are you writting the flash side too? You could just return a multi-dimensional array? $result = mysql_query(); $count = 0; while($row = mysql_fetch_row($result) { $ret[$count] = $row; $count++; } return $ret; - Original Message - From: Juan Stiller [EMAIL PROTECTED] Date: Wednesday, October 20, 2004 12:27 pm Subject: [PHP-DB] Changing this php code to show multiple variables! Hi, i´ve got this php code that sends a query to a mysql server, and when it gets the query results, it send it to a flash movieclip, everything works fine when i´ve got only one entry on the database, but when there´s more than one enrty, the variable is overwritten and as reslt, it shows only one entry i was told that i must create a function to to name multiple variables, so the result might be: Lastname0=crawFirstname0=davidLastname1=ZarlangaFirstname1=John So here it is the php code: ?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)) { echo Id={$row['id']}; echo Apellido={$row['apellidoclientesnuevos']}; echo Nombre={$row['nombreclientesnuevos']}; echo Dni={$row['dniclientesnuevos']}; echo Telefono={$row['telefonoclientesnuevos']}; echo Dia={$row['diacitaclientesnuevos']}; echo Mes={$row['mescitaclientesnuevos']}; echo Ano={$row['anocitaclientesnuevos']}; echo Hora={$row['horacitaclientesnuevos']}; echo Minutos={$row['minutoscitaclientesnuevos']}; echo Abogado={$row['abogadoclientesnuevos']}; echo Nombre={$row['nombreclientesnuevos']}; echo Asunto={$row['asuntoclientesnuevos']}; echo Donde={$row['dondeclientesnuevos']}; } mysql_free_result($result1); ? Can anyone help me with this? Thanks Juan Correo Yahoo! - 6 MB, tecnología antispam ¡gratis! Suscribite ya http://correo.yahoo.com.ar/ -- 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] Books
In all seriousness... http://www.php.net/manual/en/ - and - http://dev.mysql.com/doc/mysql/en/index.html are increible resources, no real need to throw money out for the books... - Original Message - From: Huy Ton That [EMAIL PROTECTED] Date: Monday, October 18, 2004 1:19 pm 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] mysql_query
1. place your query string into a variable for easy dumping... i.e. $query = insert into obiskovalci (ime, priimek, ulica, hstevilka, pstevilka, posta) values('$ime', '$priimek', '$ulica', '$hstevilka', '$pstevilka', '$posta'); echo $query; (See if there are problems that come to light when you dump it out) 2. Print out the debug... i.e. mysql_query($query) or die(mysql_error()); (If this doesn't help you at the very least it should help the list more in answering your question.) -B - Original Message - From: [EMAIL PROTECTED] Date: Tuesday, October 12, 2004 8:15 am Subject: [PHP-DB] mysql_query hello, I have a begining question. I've got simple html form and php script, but insert doesn' t work. What is wrong in my insert mysql_query? mysql_query( insert into obiskovalci (ime, priimek, ulica, hstevilka, pstevilka, posta) values('$ime', '$priimek', '$ulica', '$hstevilka', '$pstevilka', '$posta')); There is also id, which is auto_increment. After fill form and press Submit, id is writen in table, but there is no other inputs. Nothing, except id. thanks for answers BR, Balo -- 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] Empty query result
Why not...?? if (!($queryResult = mysql_result($queryResult, 0))) { return 0; } - Original Message - From: Philip Thompson [EMAIL PROTECTED] Date: Monday, July 26, 2004 12:57 pm Subject: Re: [PHP-DB] Empty query result Pablo, Hello Philip, pse.. can you paste the error information? There is no known empty set problem. Here's my function: function getMysqlSelectResultForUsername($identifier, $userName, $link){ $queryResult = mysql_query(select $identifier from theTable where username = '$userName', $link); if (!($queryResult = mysql_result($queryResult, 0))) { session_register('_selectIdentifierFromTheTable'); header(location:error.php); exit; } return $queryResult; } Here's the code that calls it: $hall = getMysqlSelectResultForUsername('buildingID', $_userName, $link); $roomNum = getMysqlSelectResultForUsername('roomNum', $_userName, $link); $phone1 = getMysqlSelectResultForUsername('phone1', $_userName, $link);$phone2 = getMysqlSelectResultForUsername('phone2', $_userName, $link); $lastLogin = getMysqlSelectResultForUsername('lastLogin', $_userName, $link); If the mysql_result($queryResult, 0) returns zero/nothing, then it goes to the 'error.php' page. However, I just want it to move on. For example, if there is no 'phone2' given in the database, I want it to just assign $phone2 to zero/nothing, not go to the error page. Hope this helps. Thanks, ~Philip -- Best regards, Pablo PT Hi all. PT I am querying a database of single information multiple times using a PT simple 'select' statement. However, whenever the data in the DB is PT empty or is 0 (zero), then it throws an error. However, I don't want it PT to throw an error, I just want it to move on to the next query. PT This is being shown on a webpage I have. Note that I am using a PT function for this select statement because I just have to change the PT identifier that I am looking for - saves space. So I don't use PT mysql_error() to show my errors, I redirect to a global 'error' page. PT Is there a way to get around this empty set problem? Yes, I know PT about using @ to suppress warnings, but it's more than this. PT Thanks a bunch, PT ~Philip -- 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: RE: [PHP-DB] hi (php-SSH)
I *think* I set this to you yesterday... http://www.cs.umd.edu/~arun/misc/ssh.html -Brad - Original Message - From: Suman Aluru [EMAIL PROTECTED] Date: Tuesday, July 29, 2003 12:32 pm Subject: RE: [PHP-DB] hi (php-SSH) could somebody tell me howto Generate the SSH key file to connect SSH without password from php Suman R Aluru -Original Message- From: David Smith [EMAIL PROTECTED] Sent: Monday, July 28, 2003 11:19 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] hi (php-SSH) Suman Aluru wrote: hi , is there any way to write a PHP program for SSH. I want to establish a SSH connection and work some commands in the remote system and close the connection. Yes, just do this (uses an SSH key file): ?php echo Executing remote command...br /; echo `ssh -i /path/to/key/file [EMAIL PROTECTED] ls /tmp`; echo Done executing remote command.br /; ? Use an SSH key file so you won't have to provide a password. I do this all the time for system administration, works great for inter-host communication. --Dave -- 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] md5 question!
They would be the same, they have to be. If you can de-crypt it, there has to be some method of validation. So, if someone choose the same password as you did, and you stored those in a DB as encrypted with md5, then they would look identical. So, you would know the other person's password. Hi, Hmmm okay... So if the passowrd was. jerry and the md5 output was SKHDJHDJDHJDHSfdfs and another user sets their passowrd to the same as mine does that mean the md5 output would be identical to the last as the same password is entered? e.g. User 1: Username: Fred Password: jerry User 2: Username: notfred Password: jerry Or is each entry unique ? I'm thinking if each entry was unique than reversing the md5 action could be inconclusive. But if the output is the same if the same password is entered than sure it's reliable. But I could be barking up the wrong tree all together here, so correct me if I am wrong. I have not used md5 before so learning on that behalf. Jerry --- [EMAIL PROTECTED] wrote: Just use brute force... Example: md5('password') will ALWAYS produce the same output! So, if I intercept a pmd5 encrypted password that looks like: SKHGDOIUYFB then I could just say: if (strcmp (md5('password'), SKHGDOIUYFB) == 0) printf(Your password is: %s\n, password); So, just start a loop going through all possible combinations od legal password character and encrypt with md5, then compare. Hard? Not at all, Time consuming, perhaps, but with 3+ Ghz processors coming out you'd be surprised how quickly one could loop through billlions of possible password combinations. Enter distributed environments and it is much fatser. The key is not to rely on passwords but to rely on other system security messures, use SSL, so it is hard to intercept in the first place, make sure your system is secure so these passwords cannot be extracted from your DB without you knowing about it, etc... Marco, Thanks, that's what I originally thought that it was one way. So websites that have the option to retrieve password don't use md5? I guess technically there MUST be a way to break the barrier where you can reverse it. If there is a way to make it there is always a way to break it, somehow. But what I have heard and read it's very tight and probably the best method to handle passwords for now, until something new is released. Which will happen when md5 is broken, like everything else after a little bit of time. Jerry --- Marco Tabini [EMAIL PROTECTED] wrote: Hi Jerry-- No, md5 is a one-way hash. That's why it's so safe--because if someone steals the information he still can't tell what the passwords are. You may want to reset the passwords upon your users' request and send it to them via e-mail instead. Cheers, Marco -- php|architect -- The Magazine for PHP Professionals Come try us out at http://www.phparch.com and get a free trial issue On Tue, 2003-06-24 at 08:35, JeRRy wrote: Hi, If I use md5 to handle passwords to my database is there a way to reverse the action if someone forgets their password? Is there a way for me to decode the 32bit to plain text? Jerry http://mobile.yahoo.com.au - Yahoo! Mobile - Check compose your email via SMS on your Telstra or Vodafone mobile. -- Marco Tabini President Marco Tabini Associates, Inc. 28 Bombay Avenue Toronto, ON M3H 1B7 Canada Phone: (416) 630-6202 Fax: (416) 630-5057 Web: http://www.tabini.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php http://mobile.yahoo.com.au - Yahoo! Mobile - Check compose your email via SMS on your Telstra or Vodafone mobile. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php http://mobile.yahoo.com.au - Yahoo! Mobile - Check compose your email via SMS on your Telstra or Vodafone mobile. -- 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] Image upload get file dimensions
http://us4.php.net/manual/en/function.getimagesize.php Hi there everyone, In short, I use the following to upload an image to the server: $max_size = 40; if (is_uploaded_file($userfile)) { all works great, but what I want to do is store the file details in my MySQL DB, how can I easily find out the image width and height etc from the uploaded image so that I can store this information in the DB? Thanks for your help everyone :-) Chris Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help with MySQL Logic
What about two tables, one would have this: carID carCompany carPayload etc... the second this: position carID This table would be static and if a car was not present in certain conditions they would contain (-1) for the carID. Then finding an empty slot to place an incoming car should be doable (stepping through to find (-1), and when a car is removed from a slot, then you could update the list, just dump out the 'current' order into an array, and then you would be able to sort, order, etc... Hope this makes sense. -Brad Heh. Sounds like a programming class homework project. I would say through the clever use of where clauses's, like: UPDATE position SET posistion = (position-1) WHERE position $idremoved; Would work, assuming $idremoved containted the position of the car removed. On Mon, 2003-03-03 at 10:59, Rankin, Randy wrote: Hello All, This may be a bit off topic. If so, my apololgies. A client of mine, a rail car storage company, has asked that I create a PHP/MySQL application in which they will maintain and track rail cars. I am having a bit of trouble however working through one of thier requirements. They need to know in what position the rail car is on each track. For example, they might have a track called X which will hold 30 rail cars. They would enter the car information for 30 cars and associate each of them with track X. If one of the car owners decides to move car 3 out of storage, then the remaining 29 cars must be re-numbered ( ie; car 1 and 2 would remain and car 4-30 would become car 3-29 ). In the same manner, I need to be able to add a car to the track once an empty slot is available. For example, If the new car goes at the front of the track then it would become car 1 and the remaining cars, originally numbered 1-29 would become 2-30. I hope I explained thourougly. Any suggestions would be appreciated. Randy -- Adam Voigt ([EMAIL PROTECTED]) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] getting client browser info
Well, it is a global variable/defined by PHP write a script like this: ?php phpinfo(); ? and run it. This shoudl shed some light on the situation... -Brad Hello all, I need a quick script to get the client's browser make and model. ie 5 ns 4.7 etc. I've found some info in two books but no examples of how to use it to get your visitors info. Not coming up with anything helpful on the php site - will continue to look. If anyone has done this and/or has an example I would be greatful Thx Mignon -- 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] airport codes db
You should take advantage of this highly international PHP communicty and set up a simple PHP interface to a table like: Airport Code | Airport City | Airport Name | Country | etc.. And then ask people to go in there and insert whatever information they know especially from around their area. Then you could post the rresulting mysql database somewhere for people's future use? I am working on a php page where I need some airport codes data, I have seen a few places online where you can buy this data so I was wondering if anyone has used any of these databases and if anyone had a good source for a mysql airport code db. Thanks, Eddie -- 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] Pgsql Vs. Mysql
Have you tried checking out the archives? I think this one would have a million plus one hits. Also has been discussed on Slashdot, as well as other forums. As far as difficulty to install, try it out. I would say it it relative as I'm sure a linux expert would say it is simple, whereas a linux newbie may say it is tough, I know there is plenty of excellent documentation out there. PHP has support for most everything you could want to do with pgsql. -Brad Sorry for the off-topic post, but it would be highly annoying to have to subscribe to a new mailing list for just one topic. I'm currently using mysql, but I'm considering switching to pgsql. I'm wondering which is better. Also, how hard would Pgsql be to install? Php seems to have pgsql support, but there's currently no pgsql server. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- 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] Get a single result
--- mysql_result($result_category_id, 0, $i); I think it is compaigning about the '$i' of course we don't know what that is set to, so cannot help much. I would say it might not like it when '$i' is equal to 0... :-) -Brad Hello guys. The scenery: I've got an array with some values stored in it. I want to retrieve the id code each value is associated to. So I just do the follo wing: for ($i=0; $icount($form_category);$i++) { $query_get_id = select cat_code from categories where cat_name like '$form_category[$i]'; $result_category_id = mysql_query($query_get_id) or die(mysql_error()); $form_category_id[$i] = mysql_result($result_category_id, 0, $i); //Thi s is line 170 echo $form_category[$i]. .$form_category_id[$i].br; } I'm getting the following in my browser (There are some comments I just added): Arquitectura 2 //This is the correct category name and its ID Warning: Bad column offset specified in /var/www/bva/new/common/scripts/admin_functions.php on line 170 Caricatura //This is the correct category name but the ID is lost Warning: Bad column offset specified in /var/www/bva/new/common/scripts/admin_functions.php on line 170 Ciencias naturales //Same as before Any idea of what I'm doing wrong? *** Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105145 University of Antioquia Medellín - Colombia 2002 *** -- 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] POSTGRESQL PHP
Gosh.. It could be a bunch of things. Maybe it requires a password, a username, is running on an alternate port, etc... Any more information you can provide to us would be helpful. Maybe echo out the output of pg_last_error()? -Brad I've installed MySQL and PostgreSQL on my XP. I'd like to make an PHP script working with pgsql base. I created database (typed createdb name) but when trying execute script with pg_connect(host=localhost dbname=name); it fails. Any suggestions? -- 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] Image in Mysql db
Read this: (Does a good job explaining uploads) http://www.php.net/manual/en/features.file-upload.php How I personally handle images in mysql, is not put the image in the database (Does it even allow this??) But just put the relative, or complete PATH to the image. So, your database would store: '/www/htdocs/IMAGES/some_picture.jpg' Then you can pull that from your database and use the HTML img tage to display it. HTH -Brad Hi, I know this should be simple but being a beginner... How do you insert an image into a mysql table and also how can you upload an image to a mysql table via a form. Thanks in advance. Neil -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] not a valid MySQL result
Hello, It's always good practice to put some error detection in your code, i.e. $result = mysql_query($query) or die(mysql_error()); I think your problem is the mysql does not like your query, but you are not catching it until PHP tries to figure out the number of rows returned by the query. HTH -Brad Hello guys This is my first posting to the list, even though I've had some experienc e with C++, these are my first steps with php and mysql. Well, the thing is that I'm getting the following message: Warning: Supplied argument is not a valid MySQL result resource in /var/www/bva/new/main/colecciones.php on line 35 The code is shown below: $query_cat = select author_names || ' ' || author_surnames from author, author-cat where author_cat.cat_code = $code and author.author_code = author-cat.author_code; $result_cat = mysql_query($query_cat); $num_results_cat = mysql_num_rows($result_cat); //This is line 35 I did the same with a simpler select sentence and it worked alright, so I guess there's a problem with the select sentence but haven't been able to find it. Does anyone have an idea? Thanks a lot for your help. *** Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105145 University of Antioquia Medellín - Colombia 2002 *** -- 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] need an idea...
You would probably need some API plugins to search other websites. I've seen some people open socket connections, open the site and read the raw HTML from the socket into a buffer and then parse out the information that way. I don't know if PHP was really developed for such a purpose? Maybe you can get the source code for htdig. And I think pricewatch requires that the external companies notify/register/contact them. They don't necessarily scane evry site out there, otherwise you might see Best Buy and CompUSA right? -Brad Hi, I'm wondering how can I write some php script to scan a couple of(or more) websites to find out the lowest price of a particular item? what is the idea behind this kind of programing? Also, I am always wondering how does the pricewatch website works? (I don't think that they did page by page html, right? How do they grab the data from other websites?) Thank you and your ideas and info will be much appreciated... Bo -- 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