Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Echoing Sql


Another good thing to do would be to set the sql statement equal to a variable instead of just inside of the mysql_query() function. PHP Code:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Echoing Image
form action="index.php#order" method="post" name="image1" id="image1">
<input name="image1" type="submit" id="image1" value="Buy!">

form action="index.php#order" method="post" name="image2" id="image2">
<input name="image2" type="submit" id="image3" value="Buy!">

<form name="form1" method="post" action="thankyou.php">

<?php
if ($_POST[image1]) {
echo "<img src="image/image1.jpg">";
}
if ($_POST[image2]) {
echo "<img src="image/image2.jpg">";
}
?>

Problem Echoing
If I set a varaible as

$EOL = "
"

But then want to echo that to a HTML page to see the above string
i.e.

by doing: echo($EOL);

How do I do it?

I've tried quotemeta, addslashes and htmlspecialchar
but can't seem to work it out.

Echoing An '&' Character?
I'm trying to figure out how to include an '&' character in a php echo. I'm not looking for the html & a m p ; special character, but the actual character, since i'm trying to do this: Code:

echo "<A HREF"/download.php?type=wallpaper&file=$filename">Download</A>";

instead it returns a link such as this: Code:

/download.php?type=wallpaperfile=wallpaper.zip

Echoing Php In A Textfield
when i echo out text from mysql in a text area field it also echoes out the line breaks e.g it doesn't happen if i echo out anywhere else on the page, could i do a preg_replace to make all the line breaks echo NULL? Code:

Echoing Codes
I have a simple script for an IFrame for my forum page...

<?php if(!isset($_GET['post'])){ echo '<iframe src="/forum/" name="fleet" width="800" height="auto" scrolling="no" frameborder="no" id="fleet"> Your browser does not support inline frames or is currently configured not to display inline frames. </iframe>'; }else{
 echo '<iframe src="/forum/viewtopic.php?p='.$_GET['post'].'" name="fleet" width="800" height="auto" scrolling="no" frameborder="no" id="fleet"> Your browser does not support inline frames or is currently configured not to display inline frames. </iframe>';} ?>

Whenever I open the page, it does not automatically expand to the framed page height, how can I fix this...?

Echoing Out A While In A Table
i use this while loop to echout all my categories at once, but is there a way i could have them echo out in a table say 5 across at a time? Code:

Echoing Value To List Menu
Hi, I was wondering can I echo out value from db to list menu and how?

Echoing Strings With Quotemarks?
I have a statement that gives me an error:

echo "<table><tr><td>Title</td><td>Author</td><td>Date added</td><td>Hits</td></tr><tr><td><a href="test">$arttitle</a></td><td>$artauthor (<a href=/"mailto:$artauthoremail/">)</td><td>$artcreationdate</td><td>$arthits</td></tr></table><br>";


Parse error: parse error, unexpected T_STRING, expecting ',' or '' in /home/hsphere/local/home/cmwong/singaporeanimenews.net/mm-article.php on line 299


backslashing the quotemarks continues giving the error. How might I get around this?

Echoing Variables Into HTML
So I'm playing with a very retarded list of products 1-9, and have the
following list.php page snippet excluding html header/footers/table tags:

Echoing PHP Code From A Database?
I have the following data in a MySQL database:
<a href="<?php echo $server; ?>Sugapablo-Stick_It_To_The_Man.mp3"

let's call it $row[0].

when I echo $row[0], the php code is shown as opposed to the value of
$server.

How can I get the value of $server to appear? str_replace?

Php/mysql Echoing Same Thing Twice--help!
I'm just learning php and set up a sample mysql db to practice with. I
have the following script and cannot for the life of me figure out why
it is printing each field of the row twice? I checked my db and it only
contains the entries once. What is causing this?!

-----------------------------------------------------------------------
<?php
$con_id = mysql_connect('localhost','dboard_mbr','pa1ss2wo3r d');

mysql_select_db('kp_dboard',$con_id);

echo join(mysql_fetch_array($thequery=mysql_query('sele ct * from
threads',$con_id)),' --- ') . '<br>'

echo join(mysql_fetch_array($thequery),' --- ') . '<br>'

echo join(mysql_fetch_array($thequery),' --- ');
?>
-----------------------------------------------------------------------

Strange Results Echoing '£'
I'm getting a very strange result trying to echo a simple pound sign '£'. Here's my code:

$currency = '£';
echo $currency;
For some reason it's outputting this:
£With the Â...

I've tried this as well: echo htmlentities($currency)but I get the same result.. I've never had this problem before and it doesn't6 happen with any other symbols, could anyone suggest an answer?

Echoing The Correct XML Tag Data
I am having trouble ECHOing specific data and for some reason the links for each sub parent are combined into one link...Let me explain that. The first link is correct and outputs http://example.com/1, but the second link outputs http://example.com/1http://example.com/2

Does anyone know why that is? The other problem I have is that I have about 200 sub parents in my xml file and the sub parents represent different categories, for example: Code:

Join And Echoing Correct Id
The information is displayed correctly.  The problem comes into play with the record id's. 

The link I would click on for the employees name is echoing the job id and not the employee id so I get sent to the job page and not the employee profile.  The link I would click on for the job is echoing fine. Code:

Echoing Multiple Arrays
I have a products table that I want to echo the results of 3 different categories, I can query the db just fine and get results for a single category, but I'm a newb to PHP and don't know the trick way to do slick recursion. Code:

Gathering Results And Echoing Them As One?
I'm trying to display all the results from a database and use echo them using $total.

$total =     do {  "".$row_use['lon']." ".$row_use['lat'].""  } while ($row_use = mysql_fetch_assoc($use));

echo $total;

I was wondering why does that not work?  How do I get the php repeated regions to work?

Echoing A Variable Which Isn't Set Until Later In The File?
I could have sworn this was possible somehow, but it isn't working for me... Let's say I have a line at the top of my file, which is echo "$links". Then, the variable $links is set further down in the file, depending on some SQL results and GET variables.

For me, even though I'm setting $links in the file, it will only echo if it's set before it's echoed. It make sense, but I have a definete memory that I once had a way around that problem - anyone know how to do it? Code:

Setting Headers And Echoing Images
My scenario is that I am trying to put an image on a page using php not on my server, that does not have php. I am using the tag <img src=http://myserver.com/asdf.php3> and asdf will a) read an image b) set a header("Content-type: image/gif") and c) echo the image. That works fine.
The problem is that I also wanted to include a link based on the image (ie - dynamic, involving php). After I set the header, regular tags are ignored and I can't echo anything before a header, nor can I set a different header.
SO my question is, does anyone know a workaround to this problem: like displaying an image on a non-server page, without setting a header, or a way to dynamical reference something? Any help is greatly appreciated and if you think you might be able to help, but don't understand my situation or need clarification, contact me.

PS - If it can't be done with PHP, can it be done with any other language anyone knows of?

Time - Echoing It Back Differently
I have a datetime column setup in a mysql database. My web host, which i based in Hawaii, has a different time zone to that of mine over her in good old England. I was wondering is there a way of echoing out the time from the datetime column but adding on 9 hours more?? Or even would it be easier to submit the data into the database with the time difference?

Echoing 3 Types Of Data From 1 Table Row
I have this script where one of the rows in a mysql table is named "type" tinyint(3).

now when a person joins the site they have a basic membership and their data is 0 in the type row when they become silver members it is 1 and gold is 2 all 3 numbers are entered into that one row for each member depending on what kind of membership they have.

what I want to do is echo each type of membership on a page by the total number of each type so say there is 100 basic memberships then it would add up all the 0's within the row in the mysql database and then echo that total. I have already gotten it to display total number of users by adding. Code:

$query = "select id from user";
$result = MYSQL_QUERY($query);
$totalusers=mysql_num_rows($result);
@mysql_free_result($result);
if(($s=="")or($s>=$totalusers)or($s<0)){
$s=0;}

and then having <?print $totalusers;?> where ever I want it to echo. How can I do the same with the memberships? I have a feeling that it would have something to do with $totalusers=mysql_num_rows($result); i need to change mysql_num_rows to something else?

Selective Echoing And Database Select
I have written a search engine for business listings for the company I work for. Each listing is in a database, and that works fine. The problem though is two-fold.

The first part of the problem is that not all listings utilise every column of the database, and this leaves gaps when echoing the results. This is not what i had in mind, Any ideas/help would be appreciated.

The second part of the problem is related to the first in that there is a link for any listing that has a website, but not every listing has a website, so every listing having a "Visit our Site" link is impractical and shoddy. Also, i'm not sure how to echo the url from the database effectively in the first place.

Echoing Multiple Html Tables
im trying to echo out multiple results from a database and returning them in a table. Each new row in the database leads should lead to a new row in the HTML table. However I can only get it so the first row from the database goes into the html table as it should, the rest go outside it. Any ideas? Code:

Echoing Users Data From Mysql
when users on my site look at they're profile details some of the data in like this:

<select name="somename">
<option value="Option 1">Option 1</option>
<option value="Option 2">Option 2</option>
</select>

once a user has selected an option and it's stored in mysql i was wanting the specific information to be displayed in the drop down box, if i selected option 2 next time i log in option 2 is displayed and so on. what would be the best way to achieve this?

Is_dir() And Opendir() - Detecting Sub_directories And Echoing Them?
I am working on a single script to:

1) create a menu of directories containing photos (jump to script below)
2) output all the thumbnails of each photo (linked to photo itself) within each linked directory

I have step 2 solved. However, as I was about to solve step 1, I mucked up my code so badly I lost it. I simply want to output all the sub_directory names within a directory.

my structure is as follows:

../images/photos/group
../images/photos/sports
../images/photos/outdoors
etc.

The script itself is currently located in the images directory but could also be located in the photos directory as I want to detect all sub_directories of photos. Here is the part of the script that is supposed to do what I want in step 1. PHP Code:

Not Echoing A Variable If It Exists In A MySQL Table
I have a variable $mydate which loops for all the days of a month (in a while loop), so therefore for April its:

01042007
02042007
03042007, etc...

I also have a MySQL table "bookings", which contains the field "date". This field is populated with rows of dates, with the same format as those in $mydate (eg. 01042007)
Is there any way to not echo $mydate if it exists as one of the entries in the "date" field in the database?

Php Echoing Javascript With Php Within The Javascript
I'm echoing a bit of javascript within php which itself has some php within it. I'm having trouble inserting the items properly that are surrounded by the***********. The *********** are not part of the code they are there just to point out the troubled spots.

If I replace '. $Recordset5->Fields('col1b').' and .echo strtoupper($Recordset5->Fields('col2b')). with normal text it works fine. I think my syntax or quotes are incorrect for inputting the dynamic php content within the javascript.....


Copyright © 2005-08 www.BigResource.com, All rights reserved