mysql

How to append text in php

I have this form for inputting the birthday in html. But I only have a single column for storing it in wampserver(Column Birthday). <select title="- Select Month -" name="mm" id="mm" class="" > <option value="" SELECTED >Month</option> <option value="1" >Jan</option> ...

Is it possible to use jquery to add numbers taken from mysql?

Hey guys quick question. I have a div that gets assigned a number to its id that is taken from the database on page load. I am trying to use jquery to add 1 to that number but for example if the number was 70 to begin with it just becomes 701. Anyone know what I am doing wrong? echo "<div class=\"total\" id=\"$total\">$total</div>"; va...

How to insert <br/> after each 5 results?

This is my code: $query = mysql_query("SELECT * FROM books ORDER BY id") or die(mysql_error()); while($row = mysql_fetch_assoc($query)) { echo $row["bookname"]." - "; } How to make only 5 books displayed in each line, by inserting a at the start if the row is 5 or 10 or 15 etc... Thanks ...

Mysql selecting and sorting by the bigger field

I have two fields on my table, lets say date_created and date_updated I want to select 20 recently updated/created records so it means i have to choose the top dates from both fields, how do i do that? ...

mysql query to select the bottom values from a table

Hi all, I have the following table. mysql> select * from consumer2; SERVICE_ID SERVICE_TYPE CONSUMER_FEEDBACK 31 PRINTER 1 32 PRINTER -1 33 PRINTER 0 34 PRINTER -1 35 PRINTER 0 31 PRINTER 0 32 PRINTER ...

Javascript Confirm Delete in One PHP File (on href)

<p><span class="linky"><a href="deletephone.php?id=' . $row['id'] . '">Delete Phone</a></span></p><br /> I have the above code that I am using to link to a delete script. I want to somehow incorporate Javascript with a simple onclick confirmation. This way if they choose OK, I can run the code to delete the item from the database, but ...

Invalid use of group function in MySQL 4 (not in 5)

Any idea why query SELECT m.* FROM products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c WHERE p.products_carrot = '0' and p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.l...

Find Consecutive Rows & Calculate Duration

I have a set a of data that tells me if a couple of systems are available or not every 5 or 15 minutes increments. For now, the time increment shouldn't matter. The data looks like this: Status Time System_ID T 10:00 S01 T 10:15 S01 F 10:30 S01 F 10:45 ...

authorise user from mysql database

I suck at php, and cant find the error here. The script gets 2 variables "username" and "password" from a html from then check them against a MySQL databse. When I run this I get the follow error "Query was empty" <? if ((!$_POST[username]) || (!$_POST[password])) { header("Location: show_login.html"); exit; } $db_name = "testDB...

How to call an html form back

I have this html form which will then it will call addstuds.php to execute the code for inserting records in mysql database. <form name="formcheck" method="post" action="addstuds.php"> <td width="30" height="35"><font size="3">*I D Number:</td> <td width="30"><input name="idnum" onkeypress="return isNumberKey(event)" type="text" ma...

Problem storing string containing quotes

I have the following table - $sql = "CREATE TABLE received_queries ( sender_screen_name varchar(50), text varchar(150) )"; I use the following SQL statement to store values in the table $sql = "INSERT INTO received_queries VALUES ('$sender_screen_name', '$text')"; Now I am trying to store the following string as ...

MySql mutliple tables

I've been looking into JOIN, subqueries and other ways of doing this, but I can't work out the best way to do this is... I have a table (ps_category_product): id_product, id_category I want to perform a query on it like: SELECT id_product FROM ps_category_product WHERE id_category='$this_cat' BUT, I only want to perform this query whe...

Could anyone help me with the script for this

have a table like this empid questionid options 1 1 A 2 1 A 3 1 B 4 1 C now i need result like this questionid responseA responseB responseC 1 50% 25% 25% ...

How to reslove mysql_fetch_assoc(): problems!

When i use the code below, im getting this error: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource when returning the data, anyone can fix it? Thanks! <?php $mysql_server_name="localhost"; $mysql_username=""; $mysql_password=""; $mysql_database=""; $conn=mysql_connect($mysql_server_name, $mysql_...

mySQL return index after insert

the way i have it is that I set up an insert command which works well it add the entry to my DB ...since i want to insert other entries in other tables using the unique index that was obtained from the first insertion I do a query obtain the index then reuse it other insert... though this works fine...I am sure there has to be a better w...

MySQL - definer in stored procedure

Hello. I've written all of MySQL procedures as root@localhost. Code looks like : CREATE DEFINER=`root`@`localhost` PROCEDURE `p_add_user`(...) Trouble is, when deploying on online server. When I replace root with current user and replace localhost with current IP, it works just fine. But that is quite annoyance .... Is there any way...

having trouble in mysql if statement

I just want to simplify what I am doing before, having multiple php files for all data to be listed. Here is my html form: <table border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#D3D3D3"> <tr> <form name="formcheck" method="post" action="list.php" onsubmit="return formCheck(this)...

log mysql updates

Hi to all, i have a migration script that reads from one DB and write to a second DB I usually update the existing records.I was wondering how i can log the updates like below productID : 125 title : Product1 => test update price : 125 => 140 Whitch means that the productID 125 had title Products1 and became test after update and ha...

Insert record into mysql db with Entity Framework

Hi, the problem is that it will insert a new record in a mysql table, I have already done the mapping of the mysql db and I have already done tests returning data and everything works. Now I read from a file, where there are queries written, I have them run me back and the result of true or false based on the final outcome of single quer...

Order hybrid mixed mysql search result in one query?

This problem is easy fixed clientside. But for performance I want to do it directly to the database. LIST a +------+-------+-------+ | name | score | cre | +------+-------+-------+ | Abe | 3 | 1 | | Zoe | 5 | 2 | | Mye | 1 | 3 | | Joe | 3 | 4 | Want to retrieve a joined hybrid result without dupli...