[PHP] ID problem
Hi, I'm building an CMS system (for practice and experience :)). And of course like many times before I have encountered a problem. The problem is: I have a index.php that takes the news from the database and publishes them. And by the end of every news on index.php I have a link ('a href=showfullnews.php?id=$idShow full news/a') That leads to a page that has the full news. At the beginning of showfullnews i have a variable ( $id = $_GET['id']; ) And in index.php I have the following code: while ($row = mysql_fetch_array($result)) { $id= $row['id']; etc... } In the database I have two tables one for a short version of news for index.php and another for fullNews. In full news the query is: select title,newsFull from fullnews where id='$id'; In the database i'm 100% sure there is a id = 1 in both rows. I really dont know what is the problem. Thank you very much! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID problem
2007. 02. 28, szerda keltezéssel 10.24-kor Delta Storm ezt írta: Hi, I'm building an CMS system (for practice and experience :)). And of course like many times before I have encountered a problem. The problem is: I have a index.php that takes the news from the database and publishes them. And by the end of every news on index.php I have a link ('a href=showfullnews.php?id=$idShow full news/a') That leads to a page that has the full news. At the beginning of showfullnews i have a variable ( $id = $_GET['id']; ) And in index.php I have the following code: while ($row = mysql_fetch_array($result)) { $id= $row['id']; etc... } In the database I have two tables one for a short version of news for index.php and another for fullNews. In full news the query is: select title,newsFull from fullnews where id='$id'; In the database i'm 100% sure there is a id = 1 in both rows. I really dont know what is the problem. ehh, what is the problem? you didn't tell. I guess that the fullnews page don't display the news correctly, right? if so, please show us the code of that page btw, why are you using two tables? everything could be put in one with fields like title,shorttext,fulltext and so on... and then there would be only one id for one article, which could reduce confusion and eliminate some possible problems hope that helps Zoltán Németh Thank you very much! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ID problem
-Message d'origine- De : Delta Storm [mailto:[EMAIL PROTECTED] Envoyé : mercredi 28 février 2007 10:24 À : php-general@lists.php.net Objet : [PHP] ID problem Hi, I'm building an CMS system (for practice and experience :)). And of course like many times before I have encountered a problem. The problem is: I have a index.php that takes the news from the database and publishes them. And by the end of every news on index.php I have a link ('a href=showfullnews.php?id=$idShow full news/a') That leads to a page that has the full news. At the beginning of showfullnews i have a variable ( $id = $_GET['id']; ) And in index.php I have the following code: while ($row = mysql_fetch_array($result)) { $id= $row['id']; etc... } In the database I have two tables one for a short version of I'd suggest just using one table, and when you display the short version just display a certain number of characters from the full version say 50 first chars as a preview this is what i use: function debut_texte($texte, $nb_cars) { $nb_cars = intval($nb_cars); if (!$nb_cars || !$texte) return($texte); if (strlen ($texte) = $nb_cars) return($texte); $nouveau_texte = substr($texte, 0, $nb_cars-3); $nouveau_texte .= '...'; return ($nouveau_texte); } Sorry its in french, essentialy you pass it your text ($texte) and the number of characters ($nb_cars) of that text you want to and it returns the $nb_cars first characters and appends ... to the end of the text.. This will save you some confusion by using two tables for the same data... news for index.php and another for fullNews. In full news the query is: select title,newsFull from fullnews where id='$id'; In the database i'm 100% sure there is a id = 1 in both rows. I really dont know what is the problem. Erm me neither.. Need more code to see problem. Thank you very much! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ID problem
-Message d'origine- De : tedd [mailto:[EMAIL PROTECTED] Envoyé : mercredi 28 février 2007 15:54 À : Delta Storm; php-general@lists.php.net Objet : Re: [PHP] ID problem At 10:24 AM +0100 2/28/07, Delta Storm wrote: The problem is: I have a index.php that takes the news from the database and publishes them. And by the end of every news on index.php I have a link ('a href=showfullnews.php?id=$idShow full news/a') Is this possibly a quote issue? echo 'a href=showfullnews.php?id=$idShow full news/a'; Will not evaluate $id Whereas echo 'a href=showfullnews.php?id=' . $id . 'Show full news/a'; Will evaluate $id.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID-tags from picture?
- Original Message - From: Chris [EMAIL PROTECTED] To: Gustav Wiberg [EMAIL PROTECTED] Cc: PHP General php-general@lists.php.net Sent: Tuesday, April 04, 2006 4:14 AM Subject: Re: [PHP] ID-tags from picture? Gustav Wiberg wrote: Hi guys! If I've got this right, there will be some kind of tag that is saved in a picture (hidden). Is it possible to retrieve this information from PHP and what it is called? Any ideas / suggestions would be approciated! Depends on what information you are after. Some images may have exif info, but not all. http://www.php.net/exif Possibly IPTC information too (but only applies to jpegs apparently): http://www.php.net/iptcparse -- Postgresql php tutorials http://www.designmagick.com/ Hi! And thanx a lot! Exactly what I was looking for! Best regards /Gustav Wiberg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ID-tags from picture?
Hi guys! If I've got this right, there will be some kind of tag that is saved in a picture (hidden). Is it possible to retrieve this information from PHP and what it is called? Any ideas / suggestions would be approciated! /Gustav Wiberg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID-tags from picture?
Gustav Wiberg wrote: Hi guys! If I've got this right, there will be some kind of tag that is saved in a picture (hidden). Is it possible to retrieve this information from PHP and what it is called? Any ideas / suggestions would be approciated! Depends on what information you are after. Some images may have exif info, but not all. http://www.php.net/exif Possibly IPTC information too (but only applies to jpegs apparently): http://www.php.net/iptcparse -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ID vs NAME in different browsers
Hi, when making an input field for submission from a form, I need to put a name='something' in it. For CSS I often use an id='something'. Some browsers apparently submit the field properly if name is missing and id is present. Others might not. Can anyone tell me about what browsers do what? Thanks, Niels -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID vs NAME in different browsers
On 1/28/06, Niels [EMAIL PROTECTED] wrote: when making an input field for submission from a form, I need to put a name='something' in it. For CSS I often use an id='something'. Some browsers apparently submit the field properly if name is missing and id is present. Others might not. Can anyone tell me about what browsers do what? HTML Forms should always use the NAME attribute to pass values, never ID. You can use print_r($_REQUEST); at the top of your script to debug. Jason
Re: [PHP] ID vs NAME in different browsers
On Saturday 28 January 2006 16:47, Jason Petersen wrote: HTML Forms should always use the NAME attribute to pass values, never ID. You can use print_r($_REQUEST); at the top of your script to debug. Thank you for your answer. W3C says: [http://www.w3.org/TR/html4/interact/forms.html] name = cdata [CI] This attribute names the element so that it may be referred to from style sheets or scripts. Note. This attribute has been included for backwards compatibility. Applications should use the id attribute to identify elements. So my question remains: How well do browsers support using only id? //Niels -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID vs NAME in different browsers
Niels wrote: name = cdata [CI] This attribute names the element so that it may be referred to from style sheets or scripts. Note. This attribute has been included for backwards compatibility. Applications should use the id attribute to identify elements. Uh, sorry to disappoint, but that's a description of the form element, not of the input element or select input. In fact, if you go to http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#h-17.4.2 , you will see that the example form quite clearly uses name. And for the input element, http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#h-17.4.2 says that name assigns the control name. The attributes for the form element are completely independent of the input elements. (Note, for things like radio buttons, using id makes no sense. You must have multiple elements with the same name. If you used id for these multiple elements, you would be breaking the rules of html saying only one element can have a certain id . . .) David Hall -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID vs NAME in different browsers
On Saturday 28 January 2006 18:20, David Hall wrote: Uh, sorry to disappoint, but that's a description of the form element, not of the input element or select input. Right. In fact, if you go to http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#h-17.4.2 , you will see that the example form quite clearly uses name. And for the input element, http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#h-17.4.2 says that name assigns the control name. Right. The attributes for the form element are completely independent of the input elements. Right. (Note, for things like radio buttons, using id makes no sense. You must have multiple elements with the same name. If you used id for these multiple elements, you would be breaking the rules of html saying only one element can have a certain id . . .) Excellent example! I think you've answered my question: I'll have to keep using both NAME and ID. Thanks a lot! Niels -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ID--how to keep them in order
I have a script which outputs a movie title, rating and the ID number (below). The ID number is also used in the admin section as a select for update and delete. The problem i have is that as i delete certain entries then the number sequence on the display page has missing numbers--is there a way to move all rows down to the next number in the mysql DB so the ID remains there. The easiest way is to not display the ID in the first place i am guessing, but it would be good to know if there is another way. There are 16 DVDs titles. 2 Monster in Law PG 3 Pulp Fiction MA 4 Bambi G 5 Shrek PG 6 Madagascar G 7 Grease II PG 8 Star Wars M 9 Harry Potter-Askaban PG 10 Lilo Stitch G 11 Garfield G 13 Saw I MA 14 Saw II MA 15 Longest Yard R 16 Robots PG 17 Bewitched PG 20 Team America PG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID--how to keep them in order
On Tue, Dec 20, 2005 at 02:12:43PM +0800, Anasta wrote: I have a script which outputs a movie title, rating and the ID number (below). The ID number is also used in the admin section as a select for update and delete. The problem i have is that as i delete certain entries then the number sequence on the display page has missing numbers--is there a way to move all rows down to the next number in the mysql DB so the ID remains there. The easiest way is to not display the ID in the first place i am guessing, but it would be good to know if there is another way. There are 16 DVDs titles. 2 Monster in Law PG 3 Pulp Fiction MA This is more of a db design issue, what your are looking at is the issue with: surrogate key vs. natural key Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ID from lines?
Hi there! How do I get ID number from these lines? Do I have to use regular expressions? Line #3 : NH01LiteOn DVD±RW 16725http://www.varupiraten.se/web/spec_product.php?ID=1711PC-CD-DVD-LDW-1653S-09C1 Line #4 : NH01LITEON 8x725http://www.varupiraten.se/web/spec_product.php?ID=2250CD-DVD-LDW-811S1 /G http://www.varupiraten.se/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID from lines?
- Original Message - From: Al Hafoudh [EMAIL PROTECTED] To: Gustav Wiberg [EMAIL PROTECTED] Sent: Sunday, October 09, 2005 4:38 PM Subject: Re: [PHP] ID from lines? /ID=([0-9]*)\/ Thanx! /G @varupiraten.se Gustav Wiberg wrote: Hi there! How do I get ID number from these lines? Do I have to use regular expressions? Line #3 : NH01LiteOn DVD±RW 16725http://www.varupiraten.se/web/spec_product.php?ID=1711PC-CD-DVD-LDW-1653S-09C1 Line #4 : NH01LITEON 8x725http://www.varupiraten.se/web/spec_product.php?ID=2250CD-DVD-LDW-811S1 /G http://www.varupiraten.se/ -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.11.13/124 - Release Date: 2005-10-07 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID from lines?
Hi Yes, it would work in these cases... But if there would be two or three =, then you couldn't generalize it in that matter... /G @varupiraten.se - Original Message - From: Kevin Waterson [EMAIL PROTECTED] To: Gustav Wiberg [EMAIL PROTECTED] Sent: Sunday, October 09, 2005 4:37 PM Subject: Re: [PHP] ID from lines? This one time, at band camp, Gustav Wiberg [EMAIL PROTECTED] wrote: Line #3 : NH01LiteOn DVD±RW 16725http://www.varupiraten.se/web/spec_product.php?ID=1711PC-CD-DVD-LDW-1653S-09C1 Line #4 : NH01LITEON 8x725http://www.varupiraten.se/web/spec_product.php?ID=2250CD-DVD-LDW-811S1 explode on = Kevin -- Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote. -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.11.13/124 - Release Date: 2005-10-07 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID based on position?
Auugh!! Why would you want to do this? You're flying in the face of relational database theory and practice. Position of a record in the table is, or should be irrelevant. Agreed - position is a notional concept. The data is stored physically in some sort of order, but what order that is is the database's business, not yours. It could be subject to change when upgrading, and it is very likely to differ on different platforms or RDBMSs. You should also be aware that unless you use an order by clause in your select statement, you don't have a guarantee that all RDBMSs will return the records in the same row. I don't know exactly what you want to do, perhaps you can provide more details? What if you have twenty thousand records, or two hundred, and the 45th record in the table is deleted? Fetching an ID from anything beyond that record, based on the order of insertion (position), is instantly broken. Please rethink what you want to do, and if you are not familiar with relational databases read some of the excellent tutorials available on the 'Net about them and their design. It's pretty straightforward, common sense stuff -- but you can back yourself into an awkward corner. Regards - Miles At 07:54 PM 8/31/2005, Gustav Wiberg wrote: Hi there! Is there any function in PHP that gives an ID from a MySQL-db based on which position the record has in the table? Let's say, there's a table like this: 1. Record1 ID 33 2. Record2 ID 76 3. Record3 ID 100 If I know position 2, I want to get ID 76. Is the only way to loop through the recordset? /G @varupiraten.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ID based on position?
Hi there! Is there any function in PHP that gives an ID from a MySQL-db based on which position the record has in the table? Let's say, there's a table like this: 1. Record1 ID 33 2. Record2 ID 76 3. Record3 ID 100 If I know position 2, I want to get ID 76. Is the only way to loop through the recordset? /G @varupiraten.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID based on position?
Gustav Wiberg wrote: Hi there! Is there any function in PHP that gives an ID from a MySQL-db based on which position the record has in the table? Let's say, there's a table like this: 1. Record1 ID 33 2. Record2 ID 76 3. Record3 ID 100 If I know position 2, I want to get ID 76. Is the only way to loop through the recordset? Why don't you use MySQL's LIMIT clause? Example: SELECT * FROM myTable LIMIT 1,1 will retrieve the second row from myTable. You could combine that with WHERE clauses or whatever. Note that the LIMIT syntax is LIMIT [rowcount] or LIMIT [offset],[rowcount] and the offset starts at 0. -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ If you find my advice useful, please consider donating to a poor student! You can choose whatever amount you think my advice was worth to you. http://tinyurl.com/7oa5s -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID based on position?
You could LIMIT your query to the record number you are looking for, and grab the last element in the array from your result set. But this is a serious hack, and I am really wondering why you need to do what your asking, it seems (without knowing more) that you are tackling the problem in the wrong direction, Jason On 8/31/05, Gustav Wiberg [EMAIL PROTECTED] wrote: Hi there! Is there any function in PHP that gives an ID from a MySQL-db based on which position the record has in the table? Let's say, there's a table like this: 1. Record1 ID 33 2. Record2 ID 76 3. Record3 ID 100 If I know position 2, I want to get ID 76. Is the only way to loop through the recordset? /G @varupiraten.se http://varupiraten.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID based on position?
Auugh!! Why would you want to do this? You're flying in the face of relational database theory and practice. Position of a record in the table is, or should be irrelevant. What if you have twenty thousand records, or two hundred, and the 45th record in the table is deleted? Fetching an ID from anything beyond that record, based on the order of insertion (position), is instantly broken. Please rethink what you want to do, and if you are not familiar with relational databases read some of the excellent tutorials available on the 'Net about them and their design. It's pretty straightforward, common sense stuff -- but you can back yourself into an awkward corner. Regards - Miles At 07:54 PM 8/31/2005, Gustav Wiberg wrote: Hi there! Is there any function in PHP that gives an ID from a MySQL-db based on which position the record has in the table? Let's say, there's a table like this: 1. Record1 ID 33 2. Record2 ID 76 3. Record3 ID 100 If I know position 2, I want to get ID 76. Is the only way to loop through the recordset? /G @varupiraten.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ID tymfix... thanks
Yours ID rtvfrh -- Thank attachment: uug.exe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] id name when identifying html elements
-Original Message- From: Roland Tarver [mailto:[EMAIL PROTECTED] Sent: 28 May 2003 10:07 I've got a question about about naming html components (text fields, select boxes etc) when submitting a form to a php page. First I tried identifying an element using the id attribute and found that it was not being posted to the php page. When I use the name attribute it did get posted to the page? I had a look on the w3c html spec and name takes precedence over id if used together but you should be able to use them individually with no problems. When you submit a form with this select box, country will is not submitted to the php page. select *id*=country onChange=alterForm(); option value=oneone/option option value=twotwo/option /select When you use this code, it works fine. country gets submitted to the php page? select *name*=country onChange=alterForm(); option value=oneone/option option value=twotwo/option /select Any thoughts? This is according to the HTML 4.01 specification, which says: When a form is submitted for processing, [...] controls have their name paired with their current value and these pairs are submitted with the form. This also applies to XHTML 1.0 -- indeed, the XHTML 1.0 Strict DTD says that the name= attribute is *required* for all input types except submit and reset. None of this is likely to change in the foreseeable future -- name= will always be the one to use for submitted form elements. The id= attribute is for identifying a particular element uniquely within the [X]HTML document -- no two elements can have the same id= attribute. Its most likely uses are for specifically targeted stylesheet formatting, or manipulating a specific element using a client-side technology such as JavaScript. It is absolutely *not* a substitute for name= in form elements. Hope this clears things up a bit for you. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] id name when identifying html elements
Hi I've got a question about about naming html components (text fields, select boxes etc) when submitting a form to a php page. First I tried identifying an element using the id attribute and found that it was not being posted to the php page. When I use the name attribute it did get posted to the page? I had a look on the w3c html spec and name takes precedence over id if used together but you should be able to use them individually with no problems. When you submit a form with this select box, country will is not submitted to the php page. select *id*=country onChange=alterForm(); option value=oneone/option option value=twotwo/option /select When you use this code, it works fine. country gets submitted to the php page? select *name*=country onChange=alterForm(); option value=oneone/option option value=twotwo/option /select Any thoughts? best wishes roland tarver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] id name when identifying html elements
PHP uses only the 'name' attribute of an element to assign the variable to. You can use 'id' and 'name' together, but the two are different, for instance no two form elements should have the same 'id', but depending on multiform pages with similar inputs, an identical 'name' attribute could be used several times without conflict. For PHP use, you have to use the 'name' attribute, but you've already figured that out. -- Jason k Larson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ID NUMBER HELP
Can someone help me with this. I'm trying to get ?id= set to the id number of the name in the database. I can get ?id=THE NAME but I can't get it to pick up the id number. here is the code im trying: while($row = mysql_fetch_array($result)) { printf(a href=\%s?id=%s\%s/abr\n, $PHP_SELF, $row[ID], $row[Name], $row[Name]); } If I change the first $row[ID] to $row[Name] then ?id=Name here but then when I try to extract the information from the database using: $result = mysql_query(SELECT * FROM Profiles WHERE id=$id, $dbcnx); $row = mysql_fetch_array($result); It won't work, but in the address bar if I manually change ?id=1 then the information will load fine. Can anyone help? Thanks. -Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ID NUMBER HELP
Try echo 'a href='.$PHP_SELF.'?id='.$row[ID].''.row[name].'/a'; if $row[id] still isn't shown, then you most likely aren't getting the right data from the database to the correct variable... -Original Message- From: Omland Christopher m [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 26, 2002 7:53 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [PHP] ID NUMBER HELP Can someone help me with this. I'm trying to get ?id= set to the id number of the name in the database. I can get ?id=THE NAME but I can't get it to pick up the id number. here is the code im trying: while($row = mysql_fetch_array($result)) { printf(a href=\%s?id=%s\%s/abr\n, $PHP_SELF, $row[ID], $row[Name], $row[Name]); } If I change the first $row[ID] to $row[Name] then ?id=Name here but then when I try to extract the information from the database using: $result = mysql_query(SELECT * FROM Profiles WHERE id=$id, $dbcnx); $row = mysql_fetch_array($result); It won't work, but in the address bar if I manually change ?id=1 then the information will load fine. Can anyone help? Thanks. -Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID variable alsways set
On Monday, March 4, 2002, at 02:25 AM, Rasmus Lerdorf wrote: Do a phpinfo() and check to see if you perhaps have a cookie with the name id set with the value 1. If your look at variables_order in your php.ini file, you will see that cookie data will override get-method data. To force a read from the GET data, use $_GET['id'] instead of $id. This post gave me an idea -- is it possible to write a quick mini-script that would allow me to see the contents of all cookies stored in my browser in a web page? I know that technically I could just open up the browser's prefs and look at them this way, but I could format the cookie list/contents better with a script, and it wouldn't require me clicking all over my preferences (I have a lot of cookies too). Just a thought. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ID variable alsways set
Ive just found a rather weird bug that im experiencing Im running PHP 412 with Apache 1323 on Linux Redhat 7 When ever I try and use variable $id it always has a value of 1 no matter what It only does it if its in a get, think a post too I can hard code it in a script and itll have a correct value but in a GET it gets messed up Ive tried running it several ways of having it be first in the list or last, no matter what its always 1 Example: url = http://wwwdomaincom/testphp?id=12345name=Kalamazoo File : ?php echo name = $namebr; echo id = $idbr; echo a href=\$PHP_SELF?id=12345name=Kalamazoo\click/a; ? Result : name = Kalamazoo id = 1 click ( http://wwwdomaincom/testphp?id=12345name=Kalamazoo ) Anyone have any ideas what this could come from? -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
Re: [PHP] ID variable alsways set
Do a phpinfo() and check to see if you perhaps have a cookie with the name id set with the value 1 If your look at variables_order in your phpini file, you will see that cookie data will override get-method data To force a read from the GET data, use $_GET['id'] instead of $id -Rasmus On Sun, 3 Mar 2002, Chris N wrote: Ive just found a rather weird bug that im experiencing Im running PHP 412 with Apache 1323 on Linux Redhat 7 When ever I try and use variable $id it always has a value of 1 no matter what It only does it if its in a get, think a post too I can hard code it in a script and itll have a correct value but in a GET it gets messed up Ive tried running it several ways of having it be first in the list or last, no matter what its always 1 Example: url = http://wwwdomaincom/testphp?id=12345name=Kalamazoo File : ?php echo name = $namebr; echo id = $idbr; echo a href=\$PHP_SELF?id=12345name=Kalamazoo\click/a; ? Result : name = Kalamazoo id = 1 click ( http://wwwdomaincom/testphp?id=12345name=Kalamazoo ) Anyone have any ideas what this could come from? -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
[PHP] id
when poeple sign up to my site, how can i make a code that finds if there username is already in the database? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] id
On 2/20/01 1:08 AM this was written: when poeple sign up to my site, how can i make a code that finds if there username is already in the database? Um... Search for it. $findit = mysql_query("Select username from usertable where username = '$inputted_username'"); If (mysql_num_rows($findit)) { echo "Error! username exists"; } Or whatever code you want to add there. -- Thomas Deliduka IT Manager - New Eve Media The Solution To Your Internet Angst http://www.neweve.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] ID value
$sql = "INSERT INTO songs (id,name,url) VALUES ('','Foobar','test.php?id=id)"; The id is autoincrement so obviously left blank, yet I'd like to put it into the url where id is. How do I go about dragging back the id even though it is being created (I suppose) while the statement is being made -- is it possible or do I have to Try this: mysql_db_query(" INSERT INTO songs (id,name,url) VALUE ('','Foobar','') "; mysql_db_query($sql); $id=mysql_insert_id($link); mysql_db_query=(" UPDATE songs SET (url='test.php?id=$id') WHERE id=$id "; This should work but notice that you have to do 2 SQL queries and this could slow down executing your script if there is some loop. -- Piotr Duszynski http://www.softomat.com.pl http://filmomat.3miasto.pl http://www.3miasto.pl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] ID value
Hi, I wonder whether anyone can shed some light onto this for me... Say I have this example insert: $sql = "INSERT INTO songs (id,name,url) VALUES ('','Foobar','test.php?id=id)"; The id is autoincrement so obviously left blank, yet I'd like to put it into the url where id is. How do I go about dragging back the id even though it is being created (I suppose) while the statement is being made -- is it possible or do I have to do something hackish? Sorry if that's a simple problem... Regards, Robert Morrissey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] ID value
If you are using mysql as your database, you can use mysql_insert_id. See http://www.php.net/manual/en/function.mysql-insert-id.php for more info :) HTH Sam Masiello Systems Analyst Chek.Com (716) 853-1362 x289 [EMAIL PROTECTED] -Original Message- From: Robert Morrissey [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 23, 2001 10:17 AM To: [EMAIL PROTECTED] Subject:[PHP] ID value Hi, I wonder whether anyone can shed some light onto this for me... Say I have this example insert: $sql = "INSERT INTO songs (id,name,url) VALUES ('','Foobar','test.php?id=id)"; The id is autoincrement so obviously left blank, yet I'd like to put it into the url where id is. How do I go about dragging back the id even though it is being created (I suppose) while the statement is being made -- is it possible or do I have to do something hackish? Sorry if that's a simple problem... Regards, Robert Morrissey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]