1,257 Posted Topics
Re: use following query for expected result [code] SELECT concat(min(TGL ),' till ',max(TGL )) as tgl_libur, concat(tahun,'-',semester) as tahun_semester, kererangan FROM `table_name` group by tahun,semester , keterangan [/code] | |
Re: [code] if (isset($_SESSION['y1sem1'])) $new=array_merge($_SESSION['y1sem1']); if (isset($_SESSION['y2sem1']) && isset($new)) $new=array_merge($new,$d_SESSION['y2sem1']); elseif (isset($_SESSION['y2sem1']) && !isset($new)) $new=array_merge($_SESSION['y2sem1']); if (isset($_SESSION['y3sem1']) && isset($new)) $new=array_merge($new,$_SESSION['y3sem1']); elseif (isset($_SESSION['y3sem1']) && !isset($new)) $new=array_merge($_SESSION['y3sem1']); [/code] | |
| |
Re: Insert following code at line no 60. and see whether it is fetching correct data or not [code] print"<pre>"; var_dump($datauserrow); print"</pre>"; [/code] | |
Re: 1) You join all table that are required for query. 2)apply appropriate where condition on all columns 3) write query select distinct name, address from your tables joins condition....... | |
Re: Following query will give all student name which are in student table [code]select a.studid, a.studname, b.address, b.phone from student a left outer join address b on a.studid=b.studid [/code] Following query will give only those student details which are in both table [code]select a.studid, a.studname, b.address, b.phone from student a inner … | |
Re: You may find following post useful [URL="http://www.daniweb.com/forums/thread239929.html"]http://www.daniweb.com/forums/thread239929.html[/URL] | |
Re: id, customer_id, water_records_date, water_records_usage 1, '1', '2010-02-01', '226600' 2, '1', '2010-01-01', '223000' 3, '4', '2010-01-05', '5600' 9, '4', '2010-02-19', '88000' 15, '5', '2010-02-15', '10060' 19, '5', '2009-12-02', '9000' 21, '9', '2010-02-19', '10500' 22, '9', '2009-12-02', '8900' Above is your input, Do specify how you want the ouput. | |
Re: [code] SELECT concat(date_format(frm_dt,'%d-%m-%Y'),' - ',date_format(to_dt,'%d-%m-%Y')) period FROM `tablename` [/code] or [code] SELECT concat(frm_dt,' - ',to_dt) FROM `tablename` [/code] | |
Re: Below code will display you data in following way 1 2 3 4 5 6 7 8 9 10 ...... [code] <?php $query = "select state_id,state_name from statemaster a "; $result_array =execute(query);; //you must use proper syntax to bring data in $result_array ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td … | |
Re: use date_format() function in your sql query [code] $query="select date_format(startdate, '%d/%m/%Y') as startdate, col1,col2,col2 from mytable where col1='mycondition'"; [/code] | |
Re: Following code may help you [code] <html> <body> <form> <!-- copy following php code at the place where you are populating your list box--> <?php /* set $mywholearray from database this array contains all master values to be shown in listbox $mywholearray[0]['id']='pkvalue', $mywholearray[0]['desc']='description', */ /*set $myselarray from database this array … | |
Re: You can not do anything without loop. Correct code is as follows [code] if ($no_of_types > 0) { while ($overhead_type_info = mysql_fetch_assoc($sql_result)) { extract($overhead_type_info); echo "<br>$rid, $type, $summary, $details, $cost, $purchase_date"; } } [/code] | |
Re: It will always post what ever is on your form. So you must check whether value>0 then add that item is value is 0 or null then ignore that item. | |
Re: Remove " double quote which are around your table name war. [code] $result = mysql_query("SELECT * FROM `war` WHERE `user_name`='".$_POST['u_name']."' "); [/code] | |
Re: You must write your php password verification code at the end of page. Your div tag is rendered at the end of your code. So if you want to set innerhtml in div tag, you must do it after div is rendered on the browser. [code] ... . . </body> … | |
Re: If you want to synchronize two database on separte server then you need to write some code which will read and update data on another server OR if you just want to keep backup of database on difference location then below is the one way of doing it. 1) You … | |
Re: [CODE] SELECT students.last_name, students.first_name, students.grade_level, CC1.last_name HOMETEACHER, CC2.last_name PETEACHER, CC2.PERIOD, students.student_number FROM students JOIN ( SELECT cc.studentid,teachers.last_name from CC JOIN teachers ON teachers.id = cc.teacherid WHERE (cc.course_number >= 28001 AND cc.course_number <= 28007) AND cc.dateleft = '24-JUN-10'AND cc.expression = '1(A)' )CC1 ON students.id = cc1.studentid JOIN ( SELECT cc.studentid,teachers.last_name, SUBSTR(cc.expression, … | |
Re: Family Master (all common details will come under this table) family_id, fam_address, fam_city, fam_phone) Member_master (all member related details along with family id will come under this table) member_id family_id ( foreign key from above table) member_name member_birthdate | |
Re: 1) You must keep one variable or property which will store current id being stored currquesID=1; 2) I am assuming that your question ID is numeric. 3) in nextquestion button code find minmum question number which is greater than cuRRquestID 4) load data with the found next question no. 5) … | |
Re: Inner join [b]customer_2[/b] on customer.cust_num=customer_2.cust_num | |
Re: If the string length is fixed then you can use "substr" function instead of explode. 1) Read one line at time into a variable $dataline=readnextline($filepointer); 2) store output of substr function in proper column variable $col1=substr($dataline,1,3); $col2=substr($dataline,5,1); 3) then build a insert /update query using column variables insert into table1 … | |
Re: You can set dynamic javascript code using php variable using following code. [code] <script lang='javascript'> window.location='page<?php echo $var?>.php'; </script> [/code] | |
Re: [code] select DISTINCT a.cust_num, a.phone from customer a inner join orders b on a.cust_num=b.cust_num inner join menu c on c.food_name=b.food_name where c.food_type='SOUP' OR (b.food_name='hamburgers' and b.quantity=3) [/code] | |
Re: use quotes around [code] function changeImage(obj) { obj.src ="creek.jpg"; obj.src = "dock.jpg"; } [/code] creek will be ignored and dock will be displayed. why you are doing so? | |
Re: Following query will help you. Here I assume that you have whole data string in "mytable" in column "data". Also I assume that same table contains all other 5 column. For column 1 index is -5, for 2 index is -4 and so on. [code] update table mytable set category=substr(substring_index(data,'>',-5),1,instr(substring_index(data,'>',-5),';')-1), … | |
Re: following code will return age in days for each user [code] SELECT username,datediff( current_date( ) , birthdate ) FROM datatable [/code] | |
Re: Variables in PHP are represented by a dollar sign followed by the name of the variable. The variable name is case-sensitive. | |
Re: I have attached one file. I think you need three table. I am not sure why you have used book table and reverse table. I have used only user, bookinfo and borrow tables. | |
Re: try following code in your validation function [code] else if(form1.date5.value=='0000-00-00') { alert('Select the Start Date'); form1.focus(); return false; } [/code] | |
Re: You need to do it manually i dont think mysql will do it automatically First you may determine the max no using following query and then you may use it while inserting a new record [code] //determine id //$id=SELECT max(substr(rollno,2))+1 FROM `alumni_job`; $id='c'.$id; insert into table (comp_id,name) values ('$id','$name'); [/code] | |
Re: Follow steps given below 1) Keep same column in both table with same data type say AGENT_ID. 2) keep this as primary key in both tables 3) In agent_users table keep it as auto_increment, DO NOT set agent_id as auto_increment in agent_company table. 4) In your mysql code first insert … | |
Re: 1) Your move_uploaded_file() need semicolon at the end 2) your last else( for invalid file message) is without if [code] <?php $target="upload/"; $basename=basename($_FILES["file"]["name"]); $target=$target . basename($_FILES["file"]["name"]); if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br … | |
Re: [code]<input name='answer[]' type='text'>";[/code] use above html code then you will get arrary of answer text box in php when form is submited | |
Re: try [CODE]$filter = $_REQUEST['att'];[/CODE] | |
Re: It may happen if second page is refreshed continuously. After inserting you redirect browser to another or first page. Also use cookies. | |
Re: Are you confused with report query or data structure? | |
Re: In your php code Before inserting or updating. use follwoing code [code] insertquery="insert into mytable (col1,col2,date1) values('val1','val2', date_format(".$_POST['htmldatefieldname']."'%Y-%m-%d') )" [/code] | |
Re: I guess you want to show some message or tool tip when someone moves mouse over your image. add highligted text in your code [code] <table width="80%"> <tr> <td align="center" ><img src="10000000.png" width="100%" height="60px" [b] title ='this is test' [/b]/> ><span style="overflow:hidden"> test </span></td></tr></table> [/code] | |
Re: Following code may help you. I am assuming that your ch value is number. [code] <script lang='javascript'> function openform(chval) { document.frm.chvalue=chval; document.frm.submit(); } </script> <html> echo "<form name=frm method=post action=actionpage.php target='_blank'>"; echo "<table>"; echo "<tr>"; echo "<th bgcolor=#FFCC66>Image</th>"; echo "<td bgcolor=#FFE375><input type=button value='View' onclick=' javascript:openform(".$row['ch'].") ;' > </td>"; echo "</tr>"; … | |
Re: Your query seems to be ok, though I have changed last line. Let me know what result /error are you getting. [code] $sql = "SELECT s.name,COUNT(a.id),COUNT(r.id) FROM product_items AS i LEFT JOIN watch_addtocart AS a ON a.id = i.id LEFT JOIN watch_removefromcart AS r ON r.id = i.id LEFT JOIN … | |
Re: What error are you getting. also specify cardinality of the tables. | |
What is default DBMS system in MAC. Also is there any way to develope dbms application in windows and run that file on mac os. In short which is the dbms software which which can work on both mac and windows platform? | |
Re: I am modifying line 10 to 12. [code] $method=$_POST['searchType']; if ($method=='EmployeeId') $condition="(EmployeeId = '$search' or EmployeeFname = '$search')"; else $condition="$method = '$search'"; $search=$_POST['query']; $query = mysql_query("SELECT * FROM Employee WHERE $condition"); [/code] | |
Re: You have not passed conection parameter. change you code as given below. [code] [b] $conn = mysql_connect("servername","username","password");[/b] $sql = mysql_query("SELECT * FROM forum_posts WHERE type='a' ORDER BY date_time DESC LIMIT 0, 30"[b],$conn[/b]); [/code] | |
Re: I dont think so. | |
Re: I am attaching a document which may help you in undestanding and mapping your needs to it. | |
Re: You need not to do it in query, you can do that it one loop using php code. Also you need to add order by statment at the end of your query. i.e. [b]order by index,orderindex[/b] [code] $resulthdr = oci_parse($connection, $queryhdr); if (!(oci_execute($resulthdr))) showerror(); print "\n<font face='sans-serif' size=1 color=#000000>"; print … |
The End.