Computer Webmaster Gaming Console Graphics Forum

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.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > PHP
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

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.

Google
Closed Thread
 
LinkBack Thread Tools Display Modes
Old 07-01-2007, 4:14 PM   #1
rush
 
rush's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default php variables

"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/



 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Advertisements
Old 07-01-2007, 4:14 PM   #2
Milan Puvača
 
Milan Puvača's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default php variables


"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??



 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-01-2007, 4:14 PM   #3
E-Star
 
E-Star's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default php variables

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??

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-01-2007, 4:15 PM   #4
rush
 
rush's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default php variables

"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/




 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Featured Websites
Free Space
Free Space
Free Space Free Space
Closed Thread
Tags: ,




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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




All times are GMT +1. The time now is 12:54 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98