PHP - Display Multiple Data From Mysql Table In One Line?
i have a mysql table which contains name like
mid mname 101 AAA 102 BBB 103 CCC now i have to print this name in a html table like AAA, BBB, CCC i am getting this by while loop in a variable but when loop changes then value also change so please tell me how i get this only in one variable & print Similar Tutorialshi, i'm new to php. i've got a problem. I've 3 tables and table has following content table 1 id name email address phone execution_date executor_name web_address table 2 id name email address phone execution_date executor_name project_title table 3 id name email address phone execution_date executor_name reviewer I want to export these table to and spreadsheet (.xls) with some criteria a form will assign which data will published at the spreadsheet with these criteria #all data can be exported from three tables #some column can be selected from three tables #some or all data can be selected from individual table i've implement a script for this but it didn't meet my requirements. Can anyone help? here is my script <?php $DB_Server = "localhost"; //your MySQL Server $DB_Username = "root"; //your MySQL User Name $DB_Password = "pass"; //your MySQL Password $DB_DBName = "mydb"; //your MySQL Database Name $search_from_date = $_POST['start_date']; $search_to_date = $_POST['end_date']; $Connect = @mysql_connect($DB_Server, $DB_Username, $DB_Password) or die("Couldn't connect to MySQL:<br>" . mysql_error() . "<br>" . mysql_errno()); $Db = @mysql_select_db($DB_DBName, $Connect) or die("Couldn't select database:<br>" . mysql_error(). "<br>" . mysql_errno()); $now_date = date('m-d-Y H:i'); if(($_POST['typer_of_report'] == 'rrc_report') || ($_POST['typer_of_report'] == 'all_report')) { $DB_TBLName = 'rrc_record'; } if(($_POST['typer_of_report'] == 'erc_report') || ($_POST['typer_of_report'] == 'all_report')) { $DB_TBLName2 = 'erc_record'; } if(($_POST['typer_of_report'] == 'aeec_report') || ($_POST['typer_of_report'] == 'all_report')) { $DB_TBLName3 = 'aeec_record'; } $file_type = "vnd.ms-excel"; $file_ending = "xls"; //} header("Content-Type: application/$file_type"); header("Content-Disposition: attachment; filename=protocol_report.$file_ending"); header("Pragma: no-cache"); header("Expires: 0"); if($DB_TBLName) { $sql = "Select * from ".$DB_TBLName." where execution_date >= '".$search_from_date."' and execution_date <= '".$search_to_date."' order by execution_date desc"; $Use_Title = 1; $title = "Report for $DB_TBLName on $now_date"; $result = @mysql_query($sql,$Connect) or die("Couldn't execute query:<br>" . mysql_error(). "<br>" . mysql_errno()); if ($Use_Title == 1) { echo("$title\n"); } $sep = "\t"; //tabbed character for ($i = 0; $i < mysql_num_fields($result); $i++) { echo mysql_field_name($result,$i) . "\t"; } print("\n"); while($row = mysql_fetch_row($result)) { $schema_insert = ""; for($j=0; $j<mysql_num_fields($result);$j++) { if(!isset($row[$j])) $schema_insert .= "NULL".$sep; elseif ($row[$j] != "") $schema_insert .= "$row[$j]".$sep; else $schema_insert .= "".$sep; } $schema_insert = str_replace($sep."$", "", $schema_insert); $schema_insert = preg_replace("/\r\n|\n\r|\n|\r/", " ", $schema_insert); $schema_insert .= "\t"; print(trim($schema_insert)); print "\n"; } //} echo "\n...\n"; } if($DB_TBLName2) { $sql = "Select * from ".$DB_TBLName2." where execution_date >= '".$search_from_date."' and execution_date <= '".$search_to_date."' order by execution_date desc"; $result = @mysql_query($sql,$Connect) or die("Couldn't execute query:<br>" . mysql_error(). "<br>" . mysql_errno()); $Use_Title = 1; $title = "Report for $DB_TBLName2 on $now_date"; if ($Use_Title == 1) { echo("$title\n"); } $sep = "\t"; //tabbed character for ($i = 0; $i < mysql_num_fields($result); $i++) { echo mysql_field_name($result,$i) . "\t"; } print("\n"); while($row = mysql_fetch_row($result)) { $schema_insert = ""; for($j=0; $j<mysql_num_fields($result);$j++) { if(!isset($row[$j])) $schema_insert .= "NULL".$sep; elseif ($row[$j] != "") $schema_insert .= "$row[$j]".$sep; else $schema_insert .= "".$sep; } $schema_insert = str_replace($sep."$", "", $schema_insert); $schema_insert = preg_replace("/\r\n|\n\r|\n|\r/", " ", $schema_insert); $schema_insert .= "\t"; print(trim($schema_insert)); print "\n"; } echo "\n...\n"; } if($DB_TBLName3) { $sql = "Select * from ".$DB_TBLName3." where execution_date >= '".$search_from_date."' and execution_date <= '".$search_to_date."' order by execution_date desc"; $result = @mysql_query($sql,$Connect) or die("Couldn't execute query:<br>" . mysql_error(). "<br>" . mysql_errno()); $Use_Title = 1; $title = "Report for $DB_TBLName3 on $now_date"; if ($Use_Title == 1) { echo("$title\n"); } $sep = "\t"; //tabbed character for ($i = 0; $i < mysql_num_fields($result); $i++) { echo mysql_field_name($result,$i) . "\t"; } print("\n"); while($row = mysql_fetch_row($result)) { $schema_insert = ""; for($j=0; $j<mysql_num_fields($result);$j++) { if(!isset($row[$j])) $schema_insert .= "NULL".$sep; elseif ($row[$j] != "") $schema_insert .= "$row[$j]".$sep; else $schema_insert .= "".$sep; } $schema_insert = str_replace($sep."$", "", $schema_insert); $schema_insert = preg_replace("/\r\n|\n\r|\n|\r/", " ", $schema_insert); $schema_insert .= "\t"; print(trim($schema_insert)); print "\n"; } } ?> have anyone any idea? i have 8 division (div), i want to display 4 rows in 4 division and the remain 4 rows in the next 4 division here is my code structure for carousel
<div class="nyie-outer"> second row third row
fourth row fifth row sixth row seven throw eighth row
</div><!--/.second four rows here-->
sql code
CREATE TABLE product( php code
<?php how can i echo that result in those rows
Here is a link to the website I am designing. http://173.167.65.189/singleton/ the username and password is ksingleton at the bottom where the calendar is the query is searching for scheduled events, i am only posting the company_id right now, the problem I am having is I want a scheduled event that continues through the week to stay in line with the one before. But if the schedule before ended and a new one continues it moves the next date company_id up. How can i align the table rows or create an empty table row on all other days if there was a schedule before. here is the code for the calendar. Quote <?php $db = new mysqli(); $setdate=strtotime($_GET['date']); $session=$_GET['session']; $calview=$_GET['calview']; if ($setdate <> "") { $date=$setdate; } else { $date=time(); } $day=date('d',$date); $month=date('m',$date); $year=date('Y',$date); $first_day=mktime(0,0,0,$month,1,$year); $title=date('F',$first_day); $day_of_week = date('D', $first_day); switch($day_of_week) { case "Sun": $blank = 0;break; case "Mon": $blank = 1;break; case "Tue": $blank = 2;break; case "Wed": $blank = 3;break; case "Thu": $blank = 4;break; case "Fri": $blank = 5;break; case "Sat": $blank = 6;break; } $days_in_month = cal_days_in_month(0, $month, $year); echo "<table cellpadding=0 cellspacing=0 border=0>"; echo "<tbody>"; echo "<tr>"; echo "<td><a href=?session=$session&calview=day>Day</a></td>"; echo "<td><a href=?session=$session&calview=week>Week</a></td>"; echo "<td><a href=?session=$session&calview=month>Month</a></td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=3>"; if ($calview=="month") { echo "<table border=1 width=800>"; echo "<tbody>"; echo "<tr height=25><th colspan=7> $title $year </th></tr>"; echo "<tr height=25><td width=58 align=center>Sunday</td><td width=58 align=center>Monday</td><td width=58 align=center>Tuesday</td><td width=58 align=center>Wednesday</td><td width=58 align=center>Thursday</td><td width=58 align=center>Friday</td><td width=58 align=center>Saturday</td></tr>"; $day_count = 1; echo "<tr height=50>"; while ( $blank > 0 ) { echo "<td></td>"; $blank = $blank-1; $day_count++; } $day_num = 1; while ($day_num <= $days_in_month ) { $newdate = $month ."/". $day_num ."/". $year; $msqlnewdate = date('m/d/Y',strtotime($newdate)); echo "<td valign=top><table cellpadding=0 cellspacing=0 border=0><tr><td><a href=?session=$session&calview=day&date=$newdate> $day_num </a></td></tr>"; $db = new mysqli('localhost','username','password', 'rsdata'); if (!$db) { echo 'ERROR: Could not connect to database.'; } else { $query = $db->query("SELECT * FROM rentals WHERE date_format(str_to_date(pdate_out,'%Y-%m-%d'), '%m/%d/%Y') <= '$msqlnewdate' AND date_format(str_to_date(pdate_in, '%Y-%m-%d'), '%m/%d/%Y') >= '$msqlnewdate'"); if ($query) { while ($result = $query->fetch_object()) { echo "<tr><td>".$result->company_id."</td></tr>"; } } echo "</table>"; } $day_num++; $day_count++; if ($day_count > 7) { echo "</tr><tr>"; $day_count=1; } } while ($day_count >1 && $day_count <=7 ) { echo "<td></td>"; $day_count++; } echo "</tr></table>"; } else if ($calview=="week") { } else { } echo "</td>"; echo "</tr>"; echo "</tbody>"; echo "</table>"; ?> MOD EDIT: DB credentials edited out. Hello to all, I have problem figuring out how to properly display data fetched from MySQL database in a HTML table. In the below example I am using two while loops, where the second one is nested inside first one, that check two different expressions fetching data from tables found in a MySQL database. The second expression compares the two tables IDs and after their match it displays the email of the account holder in each column in the HTML table. The main problem is that the 'email' row is displayed properly while its while expression is not nested and alone(meaning the other data is omitted or commented out), but either nested or neighbored to the first while loop, it is displayed horizontally and the other data ('validity', 'valid_from', 'valid_to') is not displayed.'
Can someone help me on this, I guess the problem lies in the while loop? <thead> <tr> <th data-column-id="id" data-type="numeric">ID</th> <th data-column-id="email">Subscriber's Email</th> <th data-column-id="validity">Validity</th> <th data-column-id="valid_from">Valid From</th> <th data-column-id="valid_to">Valid To</th> </tr> </thead> Here is part of the PHP code:
<?php while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo ' <tr> <td>'.$row["id"].'</td> '; while ($row1 = $stmt1->fetch(PDO::FETCH_ASSOC)) { echo ' <td>'.$row1["email"].'</td> '; } if($row["validity"] == 1) { echo '<td>'.$row["validity"].' month</td>'; }else{ echo '<td>'.$row["validity"].' months</td>'; } echo ' <td>'.$row["valid_from"].'</td> <td>'.$row["valid_to"].'</td> </tr>'; } ?>
Thank you. Hi, having problems getting checkboxes to display all reuslts when a user selects more than one check box say in the category section and one in the location section - see page http://www.partyco.co.uk/event-and-party-venues/ - submit to see reults page: I managed to get it to display reults if the user only seletc either a right or left column option OR one of each - BUT not when thet select multiple categories and one location - and ideas how to do this ? putting it into an array perhaps - but how - new to some of this.... here is the code for the reults page: Code: [Select] <?php $location = $_POST[location]; $category = $_POST[category]; ?> <?php $Link = mysql_connect("xxxxxxxxx", "xxxxxxxxx", "xxxxxxxx") or die(mysql_error()); mysql_select_db("xxxxxxxx") or die(mysql_error()); // selects db listings when location not given if (empty($location)) { $query = "SELECT * FROM venues WHERE category = '$category' order by title"; $result = mysql_query($query) or die(mysql_error()); // selects db listings when category not given } elseif(empty($category)) { $query = "SELECT * FROM venues WHERE location = '$location' order by title"; $result = mysql_query($query) or die(mysql_error()); // selects db listings when both given }else { $query = "SELECT * FROM venues WHERE category = '$category' and location = '$location' order by title"; $result = mysql_query($query) or die(mysql_error()); } while($row = mysql_fetch_array($result)){ echo "<div class=\"resultsShort\" style=\"margin-bottom:10px;\">"; echo "<h2 id=\"resultsHeading\">"; echo $row['title']; echo "</h2>"; echo "<p class\"resultspara\">". nl2br($row['description']). "</p>"; echo "<h4 style=\"margin:5px 0 0 0; padding:0;\">Contact details</h4>"; echo "<p class\"resultspara\">". nl2br($row['contact']). "</p>"; echo "<div style=\"float:left; width:124px; height:40px; margin:10px 15px 0 0;\">"; echo "<a href=\"/party-supplier-resources/email-supplier.php?title=". $row['title']. "&email=" . $row['email']. "&location=" . $row['location']. "&category=" . $row['category']. "\" title=\"contact this venue here\">"; echo "<img src=\"/images/email-supplier.jpg\" width=\"124\" align=\"right\" height=\"35\" alt=\"contact this supplier button\" border=\"0\" /></a>"; echo "</div>"; echo "</div>"; } ?> <?php include("../include/shareLinks.php"); ?> <div id="popupContact"> <a id="popupContactClose" title="close this window">close x</a> <h1>Supplier Directory Enquiry Form</h1> <?php include("../include/enquiryform.php"); ?> </div> <div id="backgroundPopup"></div> <?php mysql_close ($Link); ?> Any help appreciated! Aaron MOD EDIT: [code] . . . [/code] BBCode tags added. This is actually a page to edit the drama details. Database- 3 tables 1. drama dramaID drama_title 1 friends 2. drama_genre drama_genreID dramaID genreID 1 1 2 2 1 1 3 1 3 3. genre genreID genre 1 comedy 2 romance 3 family 4 suspense 5 war 6 horror <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $dbname = 'drama'; $link = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname) or trigger_error('Error connecting to mysql'); $id = $_GET['dramaID']; $link2 = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname) or trigger_error('Error connecting to mysql'); $sql2 = "SELECT * from drama , drama_genre , genre WHERE drama.dramaID='".$id."' AND drama_genre.dramaID='".$id."' AND drama.dramaID = drama_genre.dramaID AND drama_genre.genreID = genre.genreID"; $status2 = mysqli_query($link2,$sql2) or die (mysqli_error($link2)); $link3 = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname) or trigger_error('Error connecting to mysql'); $sql3 = "SELECT * from genre "; $status3 = mysqli_query($link3,$sql3) or die (mysqli_error($link3)); <form method='Post' action='doUpdate.php' enctype="multipart/form-data"> <?php while ($row2 = mysqli_fetch_assoc($status2)) { ?> <td height="1"></td> <td><select name="gdrop"> <option value="<?php echo $row2['genreID'];?>"><?php echo $row2['genre'];?></option> <?php while ($row3 = mysqli_fetch_assoc($status3)) { ?> <option value="<?php echo $row3['genreID'];?>"><?php echo $row3['genre'];?></option> <?php } mysqli_close($link3); ?> <input type='hidden' id='drama_genreID' name='drama_genreID' value = "<?php echo $row2['drama_genreID']; ?>"/> </select> <input type="hidden" id="dramaID" name="dramaID" value = "<?php echo $row['dramaID'];?>"/> <input type="submit" Value="Update"/> The result was there were 3 dropdown menus but only the first dropdown menu has all 6 genres from my database and also the genre that belongs to the drama. I'm also wondering how I can bring all the drama_genreIDs to my save(doupdate.php) page and update all 3 of them because it seems like only the last dropdown menu's data is saved. And also how can I display only 6 genres instead of 7 with the genre that belongs to the drama , being set as the default selection. I'm not sure what I'm doing wrong here... This is my index <html <head> <title>Admin applications</title> </head> <body text="#000000"> <center> <?php include("connect.php"); echo "<table cellpadding='3' cellspacing='2' summary='' border='3'>"; echo "<tr><td>Real name:<br><br>"; echo $row['real_name']; echo "</td><td>Age:<br><br>"; echo $row['age']; echo "</td><td>In-Game Name:<br><br>"; echo $row['game_name']; echo "</td><td>Steam ID:<br><br>"; echo $row['steamid']; echo "</td><td>Agreement:<br><br>"; echo $row['agreement']; echo "</td><td>Will use vent:<br><br>"; echo $row['vent']; echo "</td><td>Activity:<br><br>"; echo $row['activity']; echo "</td><td>Why this person wants to be an admin:<br><br>"; echo $row['why']; echo "</td></tr></table>"; ?> </center> </body> </html> and this is my database connect <?php $database="admin"; mysql_connect ("localhost", "root", "waygan914"); @mysql_select_db($database) or die( "Unable to select database"); mysql_query("SELECT * FROM applications"); ?> The database table "applications" has 8 fields, and 2 records, but when I view the page i get the table but no data: I am managing a shop website which is using php and mysql for data. The website has a section that will display the related products with the one that you are watching. Now my problem is that if there are more than 5 items it will continue to display all the items in one row with the consequent that the page will not display well. I need to find a way to begin a new row after the 5th item so it will display 5 items in each row. this is my current code that is responsible for showing the related items. There is also a picture attached with the problem. while ($row = mysql_fetch_array($retd)) { $code = $row["code"]; $name = $row["name"]; echo("<td width=150 align=center>"); echo ("<a href=../products/info.php?scode=$code><img src=pictures/$code.gif border=0 alt=Item $name</a>"); echo ("<br><a href=../products/info.php?scode=$code><span class=fs13>$name</span></a>"); echo("</td>"); } Does anyone know how can I do this? I insert multiple id from my checkbox to mysql database using php post form. in e.x i insert id (checkbox value table test) to mysql. no i need to any function for retrieve data from mysql and print to my page with my e.x output.(print horizontal list name of table test where data = userid) my checkbox value ( name table is test ) : Code: [Select] 01 ---id----- name ---- 02 ---1 ----- test1 ---- 03 ---2 ----- test2 ---- 04 ---3 ----- test3 ---- 05 ---4 ----- test4 ---- 06 ---5 ----- test5 ---- 07 ---6 ----- test6 ---- 08 ---7 ----- test7 ---- 09 ---8 ----- test8 ---- 10 ---9 ----- test9 ---- mysql data Insert ( name of table usertest ): Code: [Select] 1 ---id----- data ---- userid ----- 2 ---1 ----- 1:4:6:9 ---- 2 ----- 3 ---2 ----- 1:2:3:4 ---- 5 ----- 4 ---3 ----- 1:2 ---- 7 ----- example outout : ( print horizontal list name of table test where data = userid ) print? Code: [Select] 1 user id 2 choise : test1 - test4 - test6 - test9 Thanks Hi guys I need your help. I would like the data from the column "user_login" being seen as an email link. How can I do that? Thousand Thanks Code: [Select] while($rows=mysql_fetch_array($result)){ ?> <tr> <td><span class="style10"><? echo $rows['user_id']; ?></span></td> <td><span class="style10"><? echo $rows['user_first_name']; ?></span></td> <td><span class="style10"><? echo $rows['user_surname']; ?></span></td> <td><span class="style10"><? echo $rows['user_login']; ?></span></td> <td align="center"><a href="update.php?id=<? echo $rows['user_id']; ?>" class="style10">update</a></td> </tr> <?php } Morning all, and Evening everyone else. Im using the following Query to display information from a table Code: [Select] <? include "config.php"; $query1="Select *,DATE_FORMAT(date_posted,'%W,%d %b %Y') as thedate FROM article WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) ORDER BY date_posted DESC LIMIT 1 "; $blogarticles = mysql_query($query1) or die(mysql_error()); $num = mysql_num_rows($blogarticles); ?> What I am wanting to find out, is as the blog post itself could be pages long at times, is the anyway that further down the page where I actually call the data up onto the page itself I can limit how much of it is displayed? Ive succesfully added a limit to how many records are shown with the "DES LIMIT 1", is there something I can add to my query, or further down in my displaying table (which I will code just below here) to limit the lines/characters on display until the full article is opened? Display table: Code: [Select] <table width="75%" border="0" cellspacing="1" align="left"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> <? if($num > 0){ while($row_articles = mysql_fetch_assoc($blogarticles)){ ?> <tr class="title"> <td><?=$row_articles['title'];?> </td> </tr> <tr> <td> </td> </tr> <tr class="tbody"> <td><?=$row_articles['comments'];?></td> </tr> <tr> <td> </td> </tr> <tr class="links"> <td>Date posted: <?=$row_articles['date_posted'];?> | <a href="comments.php?aid=<?=$row_articles['artid'];?>&cid=<?=$row_articles['categoryID'];?>">Comments(<? //echo $row_articles['artid']; //$thenum=row_articles['artid']; $getcomments = "SELECT * FROM article WHERE artchild='".$row_articles['artid']."'"; if(!$theResult=mysql_query($getcomments)){ echo mysql_error(); }else{ $num_comments=mysql_num_rows($theResult); echo $num_comments; } ?>) </a></td> </tr> <tr class="links"> <td> </td> </tr> <tr class="links"> <td> </td> </tr> <? } }else{ ?> <tr><td><p>There are no articles available at present</p></td></tr> <? } ?> <tr> </tr> </table> Just to clarify 'comments' is the table field that holds the blog data, it also holds comments on the blog, but the child ID is what differentiates them from one another. Thanks in advance for your help ladies & gents Tom Hi Guys Just need some advice to go in the right direction. I'm working on a csv upload script (part of a bigger thing i'm building), so i read in the csv to a multipdimensional array and then build a query that inputs all rows in one query - i read this is the most efficient way to import multiple rows of data at once(rather than multiple insert statements). Just for illustration here's the code i use to build the query so you understand what i'm on about: Code: [Select] $sql = "INSERT INTO teams (company, teamname, teamnum, amountraised, country, president) VALUES "; // $rows is a count of the rows in the csv for($i=1; $i<$rows; $i++){ $sql.="('{$myarray[$i][0]}','{$myarray[$i][1]}','{$myarray[$i][2]}','{$myarray[$i][3]}','{$myarray[$i][4]}','{$myarray[$i][5]}')"; echo $i . "<br/>"; if($i >= 1 && $i < $rows - 1) { $sql.= ","; } } Anyway, the issue is that one of the fields("teamnum") needs to be unique - so i've set this as unique on the table in mysql. But when i run my query it doesn't import anything if one of the records isn't unique. What i really want is for it to import the ones it can and catch the ones it cant import to present to the user. So my question is - to acheive the above would i need to rewrite the query so that it inserts each row one at a time, instead of all together? Or can someone point me in the right direction for a better solution? Probably something very simple i've missed i am sure... Thanks chaps! Hi all . In my scripts , there is a textarea that allow user to enter multiple phone number , message and date . If there are 3 phone numbers in textarea , how can I insert 3 of them into sql with the same data of message and date? Such as : phone number : 0102255888,0235544777,0896655444 message:hello all date:10/10/2011 and when it's insert into table , it will become: 1. 0102255888 | hello all | 10/10/2011 2. 0235544777 | hello all | 10/10/2011 3. 0896655444 | hello all | 10/10/2011 Here is the code I tried , but it will just save the last phone number . Code: [Select] $cellphonenumber = explode(',', $_POST['cellphonenumber']); $message = $_POST['inputtext']; $date = $_POST['datetime']; foreach($cellphonenumber as $value) { $sql="INSERT INTO esp( Recipient , Message , Date) VALUES ('$value','$message','$date')"; } mysql_query($sql) or die ("Error: ".mysql_error()); echo "Database updated."; Any hints or advices ? Thanks for every reply . Hi all, I am trying to get data from MySQL to display in a html table in TCPDF but it is only displaying the ID. $accom = '<h3>Accommodation:</h3> <table cellpadding="1" cellspacing="1" border="1" style="text-align:center;"> <tr> <th><strong>Organisation</strong></th> <th><strong>Contact</strong></th> <th><strong>Phone</strong></th> </tr> <tbody> <tr>'. $id = $_GET['id']; $location = $row['location']; $sql = "SELECT * FROM tours WHERE id = $id"; $result = $con->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { '<td>'.$location.'</td> <td>David</td> <td>0412345678</td> </tbody>'; } } '</tr> </table>'; Anyone got any ideas? I have created 5 websites under 5 different domains. Contents of this websites' are similar and using a same template for each one. Now I need to create an admin panel to control these websites. PHP and MySql I will use for this backend.
My problem is how can I manage these five website with one backend? Reason is I will use different domain for my backend. My all 5 client will use this same backend system to manage their own website.
So can I know from the professionals here, is it possible to display mysql data on these 5 website. If it is possible then how?
Any links to article or tutorials would be welcome and appreciated.
NOTE: I checked
mysql federated storage enginebut no idea? Is it the way where do I need to go? Thank you. I have got connection to the the mysql database, how do I get the data from the database to display on the webpage im making a game and i need to show a users money but i dont know how help? Sorry for the beginner question, here I'm trying to retrieve data from the database and display it in the table format. But only table headers are printed, and not the actual values. The count variable is echoing 2 saying that data is present and correctly retrieved. Can anyone help?
<?php include 'connect.php'; error_reporting(E_ALL ^ E_DEPRECATED); error_reporting(E_ERROR | E_PARSE); $sql="SELECT * FROM `resources` as r INNER JOIN `project_resources` as pr ON r.res_id =pr.res_id WHERE project_id='$_POST[project_id]'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($result === FALSE) { die(mysql_error()); } echo "$count"; echo '<table> <tr> <th>Resource ID</th> <th>Resource Name</th> <th>Email</th> <th>Phone Number</th> <th>Reporting Manager</th> <th>Role</th> <th>Designation</th> </tr>'; while ($row = mysql_fetch_array($result)) { echo ' <tr> <td>'.$row['res_id'].'</td> <td>'.$row['res_name'].'</td> <td>'.$row['email'].'</td> <td>'.$row['phone_number'].'</td> <td>'.$row['reporting_manager'].'</td> <td>'.$row['role'].'</td> <td>'.$row['designation'].'</td> </tr>'; } echo ' </table>'; ?> Edited by mac_gyver, 22 September 2014 - 07:25 AM. code tags please Hey in my edit page i have 2 radio buttons in my form and i need to make sure the same value is still selected how can i do that? thanks Hello,
I am trying to display the data from two tables with proper format. But Its not happening
Here is my 1st table - orders
2.PNG 10.12KB
0 downloads
and my 2nd table - order_line_items
1.PNG 14.92KB
0 downloads
I want to display like this
3.PNG 4.03KB
0 downloads
Here is my code
$query = $mysqli->query("SELECT orders.order_id, orders.company_id, orders.order_for, order_line_items.order_id, order_line_items.item, order_line_items.unit,SUM(order_line_items.unit_cost * order_line_items.quantity) AS 'Total', order_line_items.tax from orders INNER JOIN order_line_items ON orders.order_id = order_line_items.order_id where orders.order_quote = 'Order' GROUP BY order_line_items.id"); ?> <table id="dt_hScroll" class="table table-striped"> <thead><tr> <th>Order ID</th> <th>Company</th> <th>Contact Person</th> <th>Products</th> <th>Total</th> </tr> </thead> <tbody> <?php while($row = $query->fetch_array()) { ?> <tr> <td><?php echo $row['order_id']; ?></td> <td><?php echo $row['company_id']; ?></td> <td><?php echo $row['contact_person'] ?></td> <td><?php echo $row['item']; ?></td> <td><?php echo $row['Total']; ?> %</td> </tr> <?php }But here order ID, Company ID, Contact Person are also repeating thrice with item in order_line_items table Please suggest me how to do this |