[Solved] Can I store query result of one field into different variables? if not then what should I do for that?

[ad_1] $query = mysql_query(“select `subject` from `markssub1` where `sname`=’$user’ AND `sid`=’$id'”); $subjects = []; while($row = mysql_fetch_array($query)) { $subjects[] = $row[‘subject’]; } foreach($subjects as $subject){ echo $subject . ‘\n’; } 3 [ad_2] solved Can I store query result of one field into different variables? if not then what should I do for that?

[Solved] SQL Print the name of all Employees together with the name of their supervisor

[ad_1] An inner join should do it. Here’s the syntax, but you’ll have to apply it to your database: SELECT c.name, o.name FROM cats c INNER JOIN owners o ON c.owner_id = o.id “cats c” basically means “Cats table, which I’m nicknaming c.” “owners o” basically means “Owners table, which I’m nicknaming o.” In your … Read more

[Solved] How to SUM Datetime per column

[ad_1] AS some of your logstep_* columns value is NULL so try like this with ifnull, I’ve added only three columns you can try with all of your columns. Hope this will help you. select SEC_TO_TIME( UNIX_TIMESTAMP(ifnull(logstep_1, 0)) + UNIX_TIMESTAMP(ifnull(logstep_2, 0)) + UNIX_TIMESTAMP(ifnull(logstep_3, 0)) ) as logstep_sum_in_time from log_step 2 [ad_2] solved How to SUM … Read more

[Solved] How big can CMS database be? [closed]

[ad_1] I know this has tons of downvotes, but you can cache your database queries. You can also mimic a CSS file using the header type in PHP. See http://css-tricks.com/css-variables-with-php/ This will allow the browser to cache the CSS file that was generated by PHP & MySQL. This means the database will only be called … Read more

[Solved] Gather column name of a table from database [closed]

[ad_1] http://php.net/manual/en/function.mysql-num-fields.php $result = mysql_query(“select * from table”); echo ‘<tr>’; for ($i = 0; $i < mysql_num_fields($result); $i++) { echo “<th>”.mysql_field_name($result, $i).”</th>”; } echo ‘</tr>’; 1 [ad_2] solved Gather column name of a table from database [closed]

[Solved] Create the timestamp of an hour ago [duplicate]

[ad_1] Just use strtotime function of php. for example: $twoHoursAgo = Date(“Y-m-d H:i:s”, strtotime(“-2 hours”)); for more refer below link Get the timestamp of exactly one week ago in PHP? 2 [ad_2] solved Create the timestamp of an hour ago [duplicate]

[Solved] Sendmail as HTML output [closed]

[ad_1] Add Content-type:text/html;charset=UTF-8 to you header and remove * from html tags like this $headers = “MIME-Version: 1.0” . “\r\n”; $headers .= “Content-type:text/html;charset=UTF-8” . “\r\n”; $headers .= “From: <****@example.com>’ . “\r\n”; $headers .= “Cc: ****@example.com’ . “\r\n”; $message =” <html> <head> <title>HTML email</title> </head> <body> <div>Hello ” . $row[‘first_name’] . ” ” . $row[‘last_name’] . … Read more

[Solved] PHP and Mysql Permission system [closed]

[ad_1] Try to use this: if ($accounttype == ‘a’) { print ‘Member’; } elseif ($accounttype == ‘b’) { print ‘Moderator’; } elseif ($accounttype == ‘c’) { print ‘Admin’; } else { print ‘No rank’; } You need use strings in a quotes, and don’t forget semicolons ; at the end of line 3 [ad_2] solved … Read more

[Solved] SQL query to retrive data [closed]

[ad_1] Better version in a single query: select p1.productname from Product p1, myorder s1, lineitem l1, customer c1 where l1.pid=p1.pid and l1.OID=s1.oid and c1.cid=s1.cid and c1.city=’mycity’ group by p1.ProductName having count(distinct c1.cid)=(select count(1) from customer c2 where c2.city=’mycity’); [ad_2] solved SQL query to retrive data [closed]

[Solved] Data Base Query [closed]

[ad_1] If I understood your question properly, then query should be like this SELECT state_name,district_name from TableName WHERE id=’jk-01′ //you can have your specific id here 1 [ad_2] solved Data Base Query [closed]

[Solved] How to join multiple tables mysql

[ad_1] This most likely won’t work since I have very little information to go on but you’re probably looking for a query somewhat like this: SELECT `order`.orderID, menuItem.`item-name`, menuGroup.`grp-name` FROM menuItem JOIN menuGroup ON menuGroup.menuGrpNo = menuItem.menuGroup LEFT JOIN orderItems ON orterItems.menuItemNo = menuItem.menuItemNo LEFT JOIN `order` ON `order`.orderID = orterItems.orderID AND `order`.orderDate BETWEEN ‘2012-02-01’ … Read more