![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| "Milan Puvača" <milan@cissteam.com> wrote in message news:bglnoc$44j$1@ls219.htnet.hr... > Here is the problem: in my application I "call" data from mysql in variable > $z but that data is for example "bla xxx", and than when I call only > variable it gives me just "bla"..how to solve that problem?? How did you manage to do that? Can you post a code snippet that is giving you a trouble? It would also be helpfull to know what is the definition for the table in question, and database you are using? rush -- http://www.templatetamer.com/ | |||
| Advertisements |
| | #2 | ||
| "rush" <pipa@rush.avalon.hr> wrote in message news:bglq6u$6pi$1@ls219.htnet.hr... > "Milan Puvača" <milan@cissteam.com> wrote in message > news:bglnoc$44j$1@ls219.htnet.hr... > > Here is the problem: in my application I "call" data from mysql in > variable > > $z but that data is for example "bla xxx", and than when I call only > > variable it gives me just "bla"..how to solve that problem?? > > How did you manage to do that? > > Can you post a code snippet that is giving you a trouble? It would also be > helpfull to know what is the definition for the table in question, and > database you are using? > > rush > -- > http://www.templatetamer.com/ > here is first par on page from which I am collecting variables: <?php $veza = mysql_connect("localhost","",""); $spoj = mysql_select_db("vijesti",$veza); $a = "select * from upis where autor = '$u'"; echo $a; $rez = mysql_query($a) or die("query neispravan"); $c = mysql_num_rows($rez); echo "<form name=form1 method=post action=ured3.php?ip=$ip>"; echo "<select name= z>"; while ($re = mysql_fetch_array($rez)) { $tema = $re["tema"]; echo "<option value=$tema>$tema</option>"; } echo "</select><br>"; echo "<input type=submit name=Submit value=Submit>"; echo " </form>"; end than on ured3.php: echo $z; // here it gives me just bla!!! end this to the end is to find news with theme from $z... $veza = mysql_connect("localhost","",""); $spoj = mysql_select_db("vijesti",$veza); $a = "select * from upis"; $rez = mysql_query($a) or die("query neispravan"); $c = mysql_num_rows($rez); while ($re = mysql_fetch_array($rez)) { if ($z == $re["tema"]) { $query="delete from upis where tema='$z';"; $rs=mysql_query($query); echo "Vijest: ". $z." uspješno obrisana!"; echo "<br><br>"; echo "<a href=teme.php?ip=$ip> Pogledaj ostale vijesti</a> <br>"; exit; } } echo "Tražena vijest ne postoji, pokušajte ponovno..."; echo "<br><br>"; echo "<a href=ured.php?ip=$ip> Povratak</a>"; ?> tables in mysql are varchar(200)... any help?? | |||
| | #3 | ||
| In article <bglqh9$77l$1@ls219.htnet.hr>, Milan Puvača <milan@cissteam.com> wrote: > here is first par on page from which I am collecting variables: > > <?php > $veza = mysql_connect("localhost","",""); > $spoj = mysql_select_db("vijesti",$veza); > $a = "select * from upis where autor = '$u'"; > echo $a; > $rez = mysql_query($a) or die("query neispravan"); > $c = mysql_num_rows($rez); > echo "<form name=form1 method=post action=ured3.php?ip=$ip>"; > echo "<select name= z>"; > while ($re = mysql_fetch_array($rez)) > { > $tema = $re["tema"]; > echo "<option value=$tema>$tema</option>"; > } > echo "</select><br>"; > echo "<input type=submit name=Submit value=Submit>"; > echo " </form>"; > > end than on ured3.php: > > echo $z; // here it gives me just bla!!! Do you have register_globals=ON? You are safer to use echo $_POST['z']; Then you will know for sure what is being passes to this page. Also, I would then put quotes around all the values in your html. If neither of these work repost your findings. > > end this to the end is to find news with theme from $z... > > $veza = mysql_connect("localhost","",""); > $spoj = mysql_select_db("vijesti",$veza); > $a = "select * from upis"; > $rez = mysql_query($a) or die("query neispravan"); > $c = mysql_num_rows($rez); > while ($re = mysql_fetch_array($rez)) > { > if ($z == $re["tema"]) > { > $query="delete from upis where tema='$z';"; > $rs=mysql_query($query); > echo "Vijest: ". $z." uspješno obrisana!"; > echo "<br><br>"; > echo "<a href=teme.php?ip=$ip> Pogledaj ostale vijesti</a> <br>"; > exit; > } > } > echo "Tražena vijest ne postoji, pokušajte ponovno..."; > echo "<br><br>"; > echo "<a href=ured.php?ip=$ip> Povratak</a>"; > ?> > > tables in mysql are varchar(200)... > any help?? | |||
| | #4 | ||
| "Milan Puvača" <milan@cissteam.com> wrote in message news:bglqh9$77l$1@ls219.htnet.hr... > here is first par on page from which I am collecting variables: .... > end than on ured3.php: > > echo $z; // here it gives me just bla!!! sure it does, but it does nothing to do with mysql. The problem is in: echo "<option value=$tema>$tema</option>"; if $tema has blanks inside for instance 'stefek i stefica', you will output following html <option value=stefek i stefica>stefek i stefica</option> which will on post send value 'stefek' not 'stefek i stefica'. I.e. you have logic error in generated html not in php. Right html to generate would be: <option value="stefek i stefica">stefek i stefica</option> And while you are at it, it would be much smarter to use some id possibly integer to select the news not the title. Also you could consider using some templates to make your programing more clean. You can find few examples here: http://www.templatetamer.org/index.p...leMySqlRowList http://www.templatetamer.org/index.p...ListboxExample rush -- http://www.templatetamer.com/ | |||
| Featured Websites | ||||
|
![]() |
| Tags: php, variables |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Variables | Jan V.Pedersen | PHP | 4 | 07-01-2007 4:17 PM |
| Passing variables | Gilbert Schroeder | PHP | 7 | 07-01-2007 3:59 PM |
| Killing variables | Barton | PHP | 0 | 07-01-2007 3:31 PM |
| declaring variables | Lothar Geyer | PHP | 1 | 07-01-2007 3:30 PM |
| php dropping variables | Dan | PHP | 3 | 07-01-2007 3:17 PM |
| Featured Websites | ||||
|