Jump to content

Recommended Posts

I have created a form that outputs information to my mysql data.

 

For example if I enter a value in a text field the value gets sent to the database and is stored as $example="value"

 

There is a populated list and its set up like this:

 

<?php

$example1="value1";

$example2="value2";

$example3="value3";

$example4="value4";

$example5="value5";

$example6="value6";

?>

 

So far everything is working, I am able to store information in the database.

 

However when I try to echo the information in my page it doesn't come up at all, its blank.

 

I can however echo the whole table but then it comes up like this:

 

<?php

$example1="value1";

$example2="value2";

$example3="value3";

$example4="value4";

$example5="value5";

$example6="value6";

?>

 

I need to echo the values separately in a text, e.g.

 

This is an example $example1 and this is what $example2 I need,

I need to echo $example3 the values individually $example 4 etc $example5

 

 

I don't know what I'm doing wrong, echoing the whole table works with:

 

$zeile=mysql_fetch_array($ger);

echo("\n".$seile['code']."\n");

 

But id like to do it separately.

Link to comment
https://forums.phpfreaks.com/topic/266987-need-help-echoing-values/
Share on other sites

I think you should start with the PHP manual tutorial. Then read up on PHP arrays and "mysql_fetch_array ()".

 

PS: Do note that the mysql_* () functions are deprecated, and that you should use MySQLi or PDO instead. (Read more about them in the manual.)

Like this??

 


$check = mysql_query("SELECT * FROM YourtableName")or die(mysql_error());

	while($info = mysql_fetch_array( $check )) 	
	{
         $example1="value1";
        $example2="value2";
        $example3="value3";

       echo "$example1";
         }

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.