I am trying to send selected check-box data through mail in the tables structure but getting below error:
implode(): Invalid arguments passed
static function mcontent($chkbox){
$sql = "SELECT station,reach,language,rate FROM `radio_city` where chkid in (".implode(',', $chkbox).")";
return DB::select($sql);
}
Please help.
Thanks
Jyoti
View1: this is used while sending data through mail
<input type="hidden" name="checkbox" id="checkbox" >
<input type="hidden" name="hiddamount" id="hiddamount">
<input type="email" name="email" id="email">
<input type="submit" id="submit" class="button" style="box-shadow: 5px 5px 3px #888888;" value="Email Plan" onsubmit="return validateForm();checkbox();"/>
function checkbox(){
if (document.myForm.checkbox.checked){
document.getElementById("error").innerHTML = "";
return true;
}
else {
document.getElementById("error").innerHTML = "Select your Plans";
}
}
View2: this is used while selecting checkboxes
<td onchange="Process(this.options[this.selectedIndex].value)" class="chart_row" align="center" >
<input type="checkbox" name="checkbox[<?php echo $i; ?>]" id="checkbox" value="<?php echo $chkid; ?>" data-price="<?php echo $total; ?>" onChange="updateTotal(this);">
</td>
<td id="station" class="chart_row" align="center"><?= $result->station ?></td>
<td id="reach" class="chart_row" align="center"><?= $result->reach ?></td>
<td id="language" class="chart_row" align="center"><?= $result->language ?></td>
<td id="rate" class="chart_row" align="center">Rs <?= $result->rate ?>/-</td>
<td id="duration" class="chart_row" align="center"><?= $duration ?></td>
<td id="frequency" class="chart_row" align="center"><?= $frequency ?></td>
<td id="hours" class="chart_row" align="center"><?= $hours ?></td>
<?php $totals += ($result->rate) * $duration * $frequency * $hours * $days/10; ?></div>
</tr>
Controller:
function mail() {
$input = Input::get();
if (isset($_GET['checkbox'])){
$city = $_GET['city'];
$duration = $_GET['duration'];
$frequency = $_GET['frequency'];
$hours = $_GET['hours'];
$days = $_GET['days'];
$total = $_GET['hiddamount'];
$chkbox = $_GET['checkbox'];
$mailrslt = Radio::mcontent($chkbox);
$cityname = Radio::getall($input);
foreach($cityname as $cities){
//modify table ans add css here if you want.
$html_table ="<table><caption>City: ".$cities->city."</caption><thead style='color:A0A0A0'><th width='200' align='center' class='tabledata' style='background: #f9f9f9;color: #000000;;border-bottom: 1px solid #d6d6d6;border-right: 1px solid #d6d6d6;padding: 5px 10px;'>Station</th>
<th width='200' align='center' class='tabledata' style='background: #f9f9f9;color: #000000;;border-bottom: 1px solid #d6d6d6;border-right: 1px solid #d6d6d6;padding: 5px 10px;'>Reach</th>
<th width='200' align='center' class='tabledata' style='background: #f9f9f9;color: #000000;;border-bottom: 1px solid #d6d6d6;border-right: 1px solid #d6d6d6;padding: 5px 10px;'>Language</th>
<th width='200' align='center' class='tabledata' style='background: #f9f9f9;color: #000000;;border-bottom: 1px solid #d6d6d6;border-right: 1px solid #d6d6d6;padding: 5px 10px;'>Rate</th>
<th width='200' align='center' class='tabledata' style='background: #f9f9f9;color: #000000;;border-bottom: 1px solid #d6d6d6;border-right: 1px solid #d6d6d6;padding: 5px 10px;'>Jingle Lenght</th>
<th width='200' align='center' class='tabledata' style='background: #f9f9f9;color: #000000;;border-bottom: 1px solid #d6d6d6;border-right: 1px solid #d6d6d6;padding: 5px 10px;'>Frequency</th>
<th width='200' align='center' class='tabledata' style='background: #f9f9f9;color: #000000;;border-bottom: 1px solid #d6d6d6;border-right: 1px solid #d6d6d6;padding: 5px 10px;'>Hours/Day</th>
<th width='200' align='center' class='tabledata' style='background: #f9f9f9;color: #000000;;border-bottom: 1px solid #d6d6d6;border-right: 1px solid #d6d6d6;padding: 5px 10px;'>Days/Week</th></thead><tbody style='color: #000000;'>";}
//whole query result is here
foreach($mailrslt as $key=>$row) {
$html_table .= "<tr>";
//Iterate your data for table data.
foreach($row as $key2=>$row2){
$html_table .= "<td width='200' align='center' class='tabledata'>" . $row2 . "</td>";
}
//Database data ends here
$html_table .= "<td width='200' align='center' class='tabledata'>" . $duration . "</td>";
$html_table .= "<td width='200' align='center' class='tabledata'>" . $frequency . "</td>";
$html_table .= "<td width='200' align='center' class='tabledata'>" . $hours . "</td>";
$html_table .= "<td width='200' align='center' class='tabledata'>" . $days . "</td>";
} //table rows ends here for displaying data
$html_table .= "</tr></tbody></table>";
//contact details and total calculation done here
$html_table .= "<p>The total negotiable cost for your activity is <b>Rs ".$total."/-</b></p><div float='right'></p><u><b>For Best Rates</b></u></br> Call: Samir-+919686595443</br>Email: samir#themediaant.com</p></div>";
$to = $input['email'];//user email id from form.
$from = 'help#themediaant.com';//from email ID
$subject = 'Self Help Radio Planner';//subject
$totals = 0;
$message = $html_table;//assigning html_table variable to message.
$contact_enquiry = new ContactEnquiry;
$contact_enquiry->email = $from;
$contact_enquiry->message = $message;
$contact_enquiry->save();
//final mail function goes here
$mail = Mail::send('emails.media_option_assistance', ['msg' => $message], function ($msg) use ($from, $to, $subject) {
$msg->from($from, 'The Media Ant');
$msg->to($to)->subject($subject);//->cc('servicing#themediaant.com');
});
//after successful mail redirect user to same page.
return Redirect::to('/radio-plan/radioplan')->with('message','<b>Congratulations! You have succesfully sent the email');
}
}
Model:
static function mcontent($chkbox){
$sql = "SELECT station,reach,language,rate FROM `radio_city` where chkid in (".implode(',', $chkbox).")";
return DB::select($sql);
}
Your problem is here
$chkbox = $_GET['checkbox'];
$mailrslt = Radio::mcontent($chkbox);
implode requires the second parameter (or the first if only one is supplied) to be an array. You are providing mcontent with a string that you get from the input. So when you reach implode inside mcontent, you are trying to convert a string to a string.
So you must either create an array with one or more variables to be passed to your function, or remove the implode from the function.
I would try to help more but honestly I don't understand much from your code and it would be a guessing game.
Related
I Have created a Program (Doctors on Leave Add/Remove Dynamically) which selects the dates from the user then select which doctor to leave and Now I want to add text input field for remarks & also show it in a table from the file I'm saving the content in..
Can Anyone help me with that please
This is my code
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$data = $_POST["doctorName"].";".$_POST["leaveFrom"].";".$_POST["leaveTo"].";";
$fp = fopen('file-path', 'a');
fwrite($fp, $data);
fclose($fp);
header("Location: #");
exit();
}
if ($_SERVER["REQUEST_METHOD"] == "GET") {
if(array_key_exists("n", $_GET)){
$newNames = "";
$filename = "file-path";
$lines = file($filename, FILE_IGNORE_NEW_LINES);
$arr_del = explode(";", $lines[0]);
for($i = 0; $i < count($arr_del)-1; $i++){
if($arr_del[$i] == $_GET["n"]){
$i = $i+2;
} else {
$newNames .= $arr_del[$i].";";
}
}
$fp = fopen('file-path', 'w');
fwrite($fp, $newNames);
fclose($fp);
header("Location: #");
exit();
}
}
?>
<html>
<body>
<center><h2>Doctor on Leave</h2></center>
<?php
$data = file_get_contents("file-path");
$arr = explode(";", $data);
echo "<table style=\"border: 1px solid black;\">";
echo "<thead>";
echo "<tr style=\"border: 1px solid black;\">";
echo "<th style=\"border: 1px solid black;\">Doctor Name</th>";
echo "<th style=\"border: 1px solid black;\">Delete</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
for($value = 0; $value < count($arr)-1; $value=$value+3) {
echo "<tr style=\"border: 1px solid black;\">";
echo "<td style=\"border: 1px solid black;\">".$arr[$value]."</td>";
echo "<td style=\"border: 1px solid black;\">"."<button id=\"".$arr[$value]."\"
onclick=\"deleteDoctor(this.id)\" style=\"background-color: red;
color:white\">Delete</button>"."</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
?>
<form action="/" method="POST">
<label>Select the Doctor </label><br>
<select name="doctorName" style="width:300px;">
<option value="Dr. Ankur Mittal">Dr. Ankur Mittal</option>
<option value="Dr. Anooj Chatley">Dr. Anooj Chatley</option>
<option value="Dr. Arti Gupta Tuli">Dr. Arti Gupta Tuli</option>
<option value="Dr. Ashok Goyal">Dr. Ashok Goyal</option>
<option value="Dr. H.S. Bindra">Dr. H.S. Bindra</option>
</select>
<br><br>
<p>From</p>
<input type="text" onfocus="(this.type='date')" id="leaveFrom" name="leaveFrom"
placeholder="DD-MM-YYYY" style="width:fit-content;">
<br><br>
<p>To</p>
<input type="text" onfocus="(this.type='date')" id="leaveTo" name="leaveTo"
placeholder="DD-MM-YYYY" style="width:fit-content;">
<br><br><input type="submit">
</form>
<script>
function deleteDoctor(name){
location.href= "#?n="+name;
}
</script>
</body>
</html>
Please check this code, It should work.
Changes I have done
Append $_POST['remarks'] in $data at line 3
Changed $i = $i+2; to $i = $i+3; at line 18, to remove newly added field. If you plan to add more fields in future, just increment this number by 1 every time
Added 3 columns in html table head (From, To and Remarks)
Printed values of From, To and Remarks on line 52, 53 and 54.
echo '<td style="border: 1px solid black;">'.$arr[$value+1].'</td>';
echo '<td style="border: 1px solid black;">'.$arr[$value+2].'</td>';
echo '<td style="border: 1px solid black;">'.$arr[$value+3].'</td>';
When you add more fields, just do it by incrementing 1
Lastly added a new input box at bottom <input type="text" id="remarks" name="remarks" placeholder="Remarks" style="width:fit-content;">
Feel free to comment if any problem with the updated code
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$data = $_POST["doctorName"].";".$_POST["leaveFrom"].";".$_POST["leaveTo"].";".$_POST["remarks"].";";
$fp = fopen('file-path', 'a');
fwrite($fp, $data);
fclose($fp);
header("Location: #");
exit();
}
if ($_SERVER["REQUEST_METHOD"] == "GET") {
if(array_key_exists("n", $_GET)){
$newNames = "";
$filename = "file-path";
$lines = file($filename, FILE_IGNORE_NEW_LINES);
$arr_del = explode(";", $lines[0]);
for($i = 0; $i < count($arr_del)-1; $i++){
if($arr_del[$i] == $_GET["n"]){
$i = $i+3;
} else {
$newNames .= $arr_del[$i].";";
}
}
$fp = fopen('file-path', 'w');
fwrite($fp, $newNames);
fclose($fp);
header("Location: #");
exit();
}
}
?>
<html>
<body>
<center><h2>Doctor on Leave</h2></center>
<?php
$data = file_get_contents("file-path");
$arr = explode(";", $data);
echo '<table style="border: 1px solid black;">';
echo '<thead>';
echo '<tr style="border: 1px solid black;">';
echo '<th style="border: 1px solid black;">Doctor Name</th>';
echo '<th style="border: 1px solid black;">From</th>';
echo '<th style="border: 1px solid black;">To</th>';
echo '<th style="border: 1px solid black;">Remarks</th>';
echo '<th style="border: 1px solid black;">Delete</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
for($value = 0; $value < count($arr)-1; $value=$value+4) {
echo '<tr style="border: 1px solid black;">';
echo '<td style="border: 1px solid black;">'.$arr[$value].'</td>';
echo '<td style="border: 1px solid black;">'.$arr[$value+1].'</td>';
echo '<td style="border: 1px solid black;">'.$arr[$value+2].'</td>';
echo '<td style="border: 1px solid black;">'.$arr[$value+3].'</td>';
echo '<td style="border: 1px solid black;">'.'<button id="".$arr[$value].""
onclick="deleteDoctor(this.id)" style="background-color: red;
color:white">Delete</button>'.'</td>';
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
?>
<form action="asd.php" method="POST">
<label>Select the Doctor </label><br>
<select name="doctorName" style="width:300px;">
<option value="Dr. Ankur Mittal">Dr. Ankur Mittal</option>
<option value="Dr. Anooj Chatley">Dr. Anooj Chatley</option>
<option value="Dr. Arti Gupta Tuli">Dr. Arti Gupta Tuli</option>
<option value="Dr. Ashok Goyal">Dr. Ashok Goyal</option>
<option value="Dr. H.S. Bindra">Dr. H.S. Bindra</option>
</select>
<br><br>
<p>From</p>
<input type="text" onfocus="(this.type='date')" id="leaveFrom" name="leaveFrom" placeholder="DD-MM-YYYY" style="width:fit-content;">
<br><br>
<p>To</p>
<input type="text" onfocus="(this.type='date')" id="leaveTo" name="leaveTo" placeholder="DD-MM-YYYY" style="width:fit-content;">
<br><br>
<p>Remarks</p>
<input type="text" id="remarks" name="remarks" placeholder="Remarks" style="width:fit-content;">
<br><br><input type="submit">
</form>
<script>
function deleteDoctor(name){
location.href= "#?n="+name;
}
</script>
</body>
</html>
I’m working on a php snippet and i made a table. I tried putting a td tag inside but when i do this, a lot disappears. This is a piece of my code:
//Use the functions of the client, the params of the function are in
//the associative array
$params = array('customerid' => '1532');
$response = $soapclient->ca_customer_products($params);
echo '<table><tbody><tr><th>Product</th><th>Naam</th> <th>Prijs</th><th>Qte</th></tr>';
echo '<table style="border-style: solid; border-width:1px;">';
foreach($response->list->element as $product) {
if($product->stock > 0) {
echo '<tr>';
echo '<td style="display: flex; border: 1px solid black;">';
//echo '<td>';
echo '<img src="' . $product->url . '" class="php_image" style="width: 15%; height: 15%;"/>';
//echo '<img style="width: 15%;">';
//echo '</td>';
print_r($product->description);
echo "<p style='color:green;'>".$product->price1."</p>";
echo "<p style='color:red; text-decoration: line-through'>".$product->price2."</p>";
print_r($product->price1);
print_r($product->price2);
print_r($product->stock);
echo '</tr>';
}
}
echo '</tbody></table>';
The code behind the // is where i tried to put the td tag but when i put it there, the images that normally appear go blank and when i inspect my code there is a lot of other code that also disappears. What am i doing wrong here?
Thank you for your help!
First I can see a problem with these lines :
echo '<table><tbody><tr><th>Product</th><th>Naam</th> <th>Prijs</th><th>Qte</th></tr>';
echo '<table style="border-style: solid; border-width:1px;">';
Because you just close your first TABLE at the end, but not the other inside :
echo '</tbody></table>';
There are some inconsistency of your <td> to <th>. You can have a look below
$params = array('customerid' => '1532');
$response = $soapclient->ca_customer_products($params);
echo '<table style="border-style: solid; border-width:1px;">
<thead>
<tr>
<th>Product</th>
<th>Naam</th>
<th>Prijs</th>
<th>Qte</th>
</tr>
</thead><tbody>';
foreach($response->list->element as $product) {
if($product->stock > 0) {
echo "<tr>
<td style='display: flex; border: 1px solid black;'>
<img src='$product->url' class='php_image' style='width: 15%; height: 15%;'/>
</td>
<td>Your product name</td>
<td>$product->description</td>
<td>
<p style='color: green;'>$product->price1</p>
<p style='color: red;'>$product->price</p>
</td>
<td>$product->stock</td>
</tr>";
}
}
echo '</tbody></table>';
?>
There's a lot problems with the code. From what i can see in your code, you have a table inside a tbody and at the end closed only one table.
Secondly you're also trying to put a td inside another td which is not the right thing to do. Check out mozilla developer website for more information on using HTML tables.
//Use the functions of the client, the params of the function are in
//the associative array
$params = array('customerid' => '1532');
$response = $soapclient->ca_customer_products($params);
echo '<table style="border-style: solid; border-width:1px;"><tbody><tr><th>Product</th><th>Naam</th> <th>Prijs</th><th>Qte</th></tr>';
foreach($response->list->element as $product) {
if($product->stock > 0) {
echo '<tr>';
echo '<td style="display: flex; border: 1px solid black;">';
//echo '<td>';
echo '<img src="' . $product->url . '" class="php_image" style="width: 15%; height: 15%;"/>';
//echo '<img style="width: 15%;">';
//echo '</td>';
print_r($product->description);
echo "<p style='color:green;'>".$product->price1."</p>";
echo "<p style='color:red; text-decoration: line-through'>".$product->price2."</p>";
print_r($product->price1);
print_r($product->price2);
print_r($product->stock);
echo '</td></tr>';
}
}
echo '</tbody></table>';
You are not closing your tags correctly. Also checkout the docs just as #christopher_bincom has mentioned.
I have two files: Studio.php and Principale.php
In the first one i want insert in my database some values and add them also in a table of Principale.php
With the first row of the table in Principale.php and the first add in the table of my database it works, after no.
I thought to use a for loop to create more rows in the table of Principale.php
It shows me also this error : Notice: Undefined index: titolo1 in C:\xampp\htdocs\Progetto\Principale.php on line 47
I think $res2 return a value different than TRUE but i don't know why.
Code of Principale.php :
$n=$_COOKIE['idstudio'];
for ($i=1;$i<$n;$i++) {
echo "<table style='border: 1px solid black; margin-left:auto; margin-
right:auto;'><caption> <p>Esperienze di Studio</p>
</caption> <thead style='color:green;'> <tr>";
echo "<th style='border: 1px solid black;'> Titolo </th><th
style='border: 1px solid black;'> Anno </th><th style='border: 1px solid
black;'> Luogo </th> ";
echo "</tr> </thead> <tbody style='color:blue'> <tr>";
echo "<td style='border: 1px solid black;'>".$_COOKIE["titolo$i"]."
</td>";
echo "<td style='border: 1px solid black;'>".$_COOKIE["anno$i"]."</td>";
echo "<td style='border: 1px solid black;'>".$_COOKIE["luogo$i"]."
</td>";
echo "</tr></tbody</table><br><br>";
}
echo "</div>";
Code of Studio.php :
$luogo = $_POST["luogo"];
$anno = $_POST["anno"];
$titolo = $_POST["titolo"];
$sql6="SELECT education_experience_id FROM education_experience ORDER BY
education_experience_id DESC LIMIT 1;";
$result2=mysqli_query($connessione,$sql6);
$row2=mysqli_fetch_array($result2,MYSQLI_NUM);
$last_id2=$row2[0];
$id2 = $last_id2+1;
$eeid=$_COOKIE['id'];
$sql9="INSERT into EDUCATION_EXPERIENCE
(education_experience_id,title,year,place,user_id) VALUES
('$id2','$titolo','$anno','$luogo','$eeid')";
$res2=mysqli_query($connessione,$sql9);
echo "<br>";
mysqli_error($connessione);
if($res2 ==TRUE) {
setcookie("luogo$id2", $luogo, strtotime("+1 month"));
setcookie("anno$id2", $anno, strtotime("+1 month"));
setcookie("titolo$id2", $titolo, strtotime("+1 month"));
setcookie("idstudio",$id2,strtotime("+1 month"));
header("Location: Principale.php");
}
else
{
echo "Impossibile aggiungere Esperienza<br>";
echo "<a href='Principale.php'>Clicca Qui</a> per tornare alla pagina
principale.";
}
Can't understand how correctly get all info from web, not just one row but all.
This script produces the output : Array Array Array Array and only one row.
<table id="rounded-corner" width=100%>
<tr>
<td>Nuotrauka</td>
<td>Pavadinimas</td>
<td>miestas</td>
<td>metai</td>
<td>kaina</td>
</tr>
<?
$url = "My Link";
$contents = file_get_contents($url);
preg_match_all("|<span class=\"ttitle2\">(.*?) </span>|U",$contents,$pavadinimas);
preg_match_all("|<span class=\"ttitle3\">(.*?)</span>|U",$contents,$miestas);
preg_match_all("|<span class=\"ttitle1\">(.*?)</span>|U",$contents,$metai);
preg_match_all("|<span class=\"ttitle1\" style='float: left;'>(.*?)<br />|U",$contents,$kaina);
preg_match_all("/<img .*?(?=src)src=\"([^\"]+)\"/si", $contents, $img_link);
$output = "<tr><td><img src=$img_link></td><td>$pavadinimas</td><td>$miestas</td><td>$metai</td><td>$kaina</td></tr>";
print_r($output);
?>
</table>
Try this. It is extracting data as required.
<table style="border: 1px solid black;" id="rounded-corner" width=100%>
<tr>
<td style="border: 1px solid black;">Nuotrauka</td>
<td style="border: 1px solid black;">Pavadinimas</td>
<td style="border: 1px solid black;">miestas</td>
<td style="border: 1px solid black;">metai</td>
<td style="border: 1px solid black;">kaina</td>
</tr>
<?php
$url = "put_your_url";
$contents = file_get_contents($url);
preg_match_all('/<span class="ttitle2".*?>(.*?)<\/span>/',$contents,$pavadinimas);
preg_match_all('/<span class="ttitle3".*?>(.*?)<\/span>/',$contents,$miestas);
preg_match_all('/<span class="ttitle1".*?>(.*?)<\/span>/',$contents,$metai_kaina);
foreach($metai_kaina[0] as $key=>$metai_kaina_val){
if($key%2==0)
$metai[] = strip_tags($metai_kaina_val);
else
$kaina[] = strip_tags($metai_kaina_val);
}
preg_match_all('/<img .*?(?=src)src=\"([^\"]+)\"/si', $contents, $img_link);
for($i=0; $i<count($pavadinimas[0]); $i++){
echo '<tr>
<td style="border: 1px solid black;"><img src="'.$img_link[1][$i+2].'"></td>
<td style="border: 1px solid black;">'.$pavadinimas[0][$i].'</td>
<td style="border: 1px solid black;">'.$miestas[0][$i].'</td>
<td style="border: 1px solid black;">'.$metai[$i].'</td>
<td style="border: 1px solid black;">'.$kaina[$i].'</td>
</tr>';
}
?>
</table>
The $matches parameter of the function will always be an array - you need to process the variable before adding them to the output string.
http://php.net/manual/en/function.preg-match-all.php
As far as I'm aware you can't print_r a mixture of string and array.
If all matchings return the same number of results, which seems to be implied by your $output structure, iterate over one of them:
$output = '';
foreach ($pavadinimas[1] as $index => $match) {
$output .= '<tr><td><img src=' . $img_link[1][$index] . '></td><td>' . $match . '</td><td>' . $miestas[1][$index] . '</td><td>' . $metai[1][$index] . '</td><td>' . $kaina[1][$index] . '</td></tr>';
}
preg_match_all makes deep complex search. Maximum it'll be two dimentional array. Read docs
how to correctly get all info?
For this to find out you just dump out all the result info:
print_r($pavadinimas);
print_r($miestas);
...
but i need that all info put in table
Be little more inventive; if $pavadinimas is 2d array:
echo '<table>';
foreach($p in $pavadinimas){
echo '<tr>';
foreach($item in $p){
echo '<td>' , $item , '</td>' ;
}
echo '</tr>';
}
echo '</table>';
Note
To invert the 2d array order you just use flag (PREG_PATTERN_ORDER or PREG_SET_ORDER) in the preg_match_all (see flag section in docs). Thus you will have your table with other order.
Evening All, just trying to figure out why some of my variables are not echoing from my MYSQL database. At first they were going to be Session variables of which i found did not work, so then i changed to a mysql query on my invoice page
$OrderID = $_SESSION[OrderID];
$LName = mysql_result(mysql_query("SELECT LName FROM customers WHERE Username = '$Username'"), 0);
$Fname = mysql_result(mysql_query("SELECT FName FROM customers WHERE Username = '$Username'"), 0);
$Date = mysql_result(mysql_query("SELECT Date FROM orders WHERE OrderID = '$OrderID'"), 0);
My Queries above. Order ID and Date are working, yet Lname and Fname are not where everything is named correctly as they are in the database.
Full Code below of where i am trying to echo them.
<div id='containter' style='position:absolute;width:750px;height:800px; left:50% ; margin-left: -375px; border-style: solid;border-width: 1px;'>
<div id='heading' style='position:absolute;width:650px;height:100px; left:50% ; margin-left: -325px;top:20px; border-style: solid;border-width: 1px;'>
<div style='position:absolute;left:500px;text-align:center;font-size:36px;'> <p>INVOICE </p></div>
<div style='position:absolute;text-align:center;font-size:38px;width:250px;left:-20px;'> OzScopes</div>
<div style='position:absolute;text-align:center;font-size:16px;width:250px;left:-37px;top:45px;'> ozscopes.com.au</div>
<div id='headingbottom' style='position:absolute;width:100%;height:20px;top:80px;'>
<table>
<tr>
<td style='position:absolute;left:5%;'>Invoice Number </td>
<td style='position:absolute;left:25%;'> <?php echo $OrderID;?> </td>
<td style='position:absolute;left:77%;'><?php echo $Date ;?></td>
</tr>
</table>
</div>
</div>
<div id='invoicecontent' style='position:absolute;width:650px;height:600px; left:50% ; margin-left: -325px;top:140px; border-style: solid;border-width: 1px;'>
<div id='information'>
<div id='customerinfo' style='position:absolute;width:255px;height:75px;top:-210px;padding:10px; border-bottom: 2px solid;border-right:1px solid; display:inline'>
<table>
<tr>
<th>Customer Information</th>
</tr>
<tr>
<td> <?php echo $LName;?> lnametest</td>
</tr>
</table>
</div>
<div id='mailinginfo' style='position:absolute;width:355px;height:75px;left:275px;top:-210px;padding:10px;border-bottom: 2px solid; display:inline'>
Mailing Information
</div>
</div>
<div id='products' style='position:absolute;top:97px;width:650px;height:503px;'>
<?php
echo "<table border=\"0\" cellspacing=\"0\" padding=\"0\" width=\"650px\">";
echo "<tr style='font-weight: bold; font-size:16px;'>";
echo "<td colspan=\"2\" align=\"center\" style='border-bottom: 2px solid;font-family:'Ek Mukta';color:#464d48;'>Description</td>";
echo "<td align=\"left\" style='border-bottom: 2px solid;font-family:'Ek Mukta';color:#464d48;'>Quantity</td>";
echo "<td colspan=\"3\" align=\"center\" style='border-bottom: 2px solid ;font-family:'Ek Mukta';color:#464d48;'>Price (Per Unit)</td>";
echo "<td align=\"center\" style='border-bottom: 2px solid;font-family:'Ek Mukta';color:#464d48;'>Total</td>";
echo "</tr>";
echo "</table>";
?>
</div>
<div id='payment'>
</div>
</div>
</div>
Where are you getting $Username? should you get it from the session first?
Like so:
$Username = $_SESSION[Username];
otherwise this string is empty and the select statement will come back as empty, because the where clause was based on username = $Username (which in this case is empty).
Get username of the session variable first, then use it in where clause. Apart from that, as others have said, please avoid using mysql queries, use mysqli instead.
Hope it helps.