473,326 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

how to display an array variable

142 100+
Hi,

In my script the {$a[0]}"; does not want to assing to $p1 at the $p1="{$a[0]}";
line.


[PHP]
$result = mysql_query("SELECT * FROM hole ORDER BY a5");

$i = 0;
$a = array();
while($row = mysql_fetch_array($result))
{
$a[$i] = $row['a5'];
++$i;
}

mysql_close($con);

echo "{$a[0]} {$a[1]} {$a[2]} {$a[8]}";

/////////// hole 1 ////////////
$p1="{$a[0]}"; //// ************ HELP******
if ($p1=="on") /////Show not taken
$p1="on"; /////show taken
else
$p1="off";
[/PHP]
Mar 16 '08 #1
3 1228
webandwe
142 100+
I thin I got the problem...Just checking

[PHP]
$p1="{$a[0]}"; ////Check hole
if ($p1=="{$a[0]}") /////Show not taken
$p1="15"; /////show taken
else
$p1="off";
[/PHP]
Mar 16 '08 #2
Markus
6,050 Expert 4TB
I thin I got the problem...Just checking

[PHP]
$p1="{$a[0]}"; ////Check hole
if ($p1=="{$a[0]}") /////Show not taken
$p1="15"; /////show taken
else
$p1="off";
[/PHP]
You dont always have to use quotes and curly brackets.
[php]
$p1 = $a[0];
if($p1 == $a[0])
$p1 = "15";
else
$p1 = "off";
[/php]
Mar 16 '08 #3
ronverdonk
4,258 Expert 4TB
Variable not working can in no way be considered a meaningful title. Since when does a variable 'work'??

Please remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).

This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.

MODERATOR
Mar 16 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Randell D. | last post by:
I have a script (below) that can be passed an array and it will dump the contents of the array in to an html table - I use it during development so its nothing sexy. It handles multidimsional...
5
by: Michelle | last post by:
Hi all, I am taking a class in PHP and thought that it would be nice to display the PHP code that generated my pages when the user clicked a link (or submit button). I have seen page that will...
2
by: erica | last post by:
Hi, I am currently writing PHP code for some polling software. When someone votes, it stores their IP address in the database. From then on, they cannot vote in that particular poll, they only...
2
by: Ravi | last post by:
My XML looks like: <abc> <def type="apple"> 1 </def> <def type="peach"> 2 </def> <def type="orange"> 3 </def> <def type="banana"> 4 </def> <def type="plum"> 5 </def> </abc>
4
by: Eric A. Johnson | last post by:
For the following code: ' return String representation of CTriangleShape Public Overrides Function ToString() As String ' use MyBase reference to return CShape String Return...
2
by: ameshkin | last post by:
I know this is probably not too hard to do, but how do I display multiple rows of a mysql query/recordset. Im having trouble doing this. I don't just want to display them, but I want to make sure...
1
by: Objectifnet | last post by:
What I really want to do is to be able to link two pages together using an ID, The table involved displays an image stored on the File Server that has the image details stored in the Database called....
6
sammyboy78
by: sammyboy78 | last post by:
I'm trying to display my array of objects in a GUI. How do I get JLabel to refer to the data in my objects? I've read my textbook and some tutorials online I just cannot get this. Plus all the...
0
parshupooja
by: parshupooja | last post by:
Contact Reply 1 point Member propoo Joined on 08-31-2007, 10:32 PM Posts 3 Hey all ,
2
Claus Mygind
by: Claus Mygind | last post by:
I have an array of objects (a hash table). My section of code, the "for in" loop (lines 18 to 41) does not execute at full speed. But if I put in an alert box (line 13) to stop program execution...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.