1,257 Posted Topics
Re: You must keep id column unique at database level. Without checking the duplication at frontend, you must attempt to insert a new row. If id exist in database it will throw an error with error code which you should trace in your code. if error code is for duplicate id … | |
Re: Following code is for 3 columns and n no of rows. it will print you ID as 1 2 3 4 5 6 .... [code] <?php $isrowopen=false; $totalrows=0; while ($prows = mysql_fetch_array($rs_pending)) { $totalrows++; if((($totalrows)%3)==1) { print "\n<tr>"; $isrowopen=true; } ?> <td>#<?php echo $prows['id']?></td> <?php if((($totalrows)%3)==0) { print "\n</tr>"; $isrowopen=false; … | |
Re: There is no rule for using multiple join. It depends on the structure of your table. If your table has any column which referes to pk of same table. then you need to use multiple join in order to retrive information. | |
Re: your er diagram could be of two types 1) logical: used to understand database conceptually, may not reflect actual no of table in database. for e.g when showing many to many relation we may show only 2 related entities in diagram 2) physical: user to show all table used in … | |
Re: set @counter:=6000; select *, @counter:=(@counter +1) rownum from tablename; | |
Re: You print your failing query string on screen. Copy it and execute in mysql query browser or phphmyadmin or msql prompt directly. There you will find the actual problem. [code] System.out.println("insert into Reservation values(" + maxResID + "," + maxGuestID +",'"+ChkPrepaid.getSelectedObjects()+",'"+txtCheckInDate.getText()+"','"+txtCheckOutDate.getText()+ "'"); [/code] | |
Re: [code] $result = mysql_query("SELECT name FROM user WHERE month(dob) = '$current_month' AND day(dob) >= '$current_day' ") [/code] | |
Re: Generally log file occupies more space in sql server 2000, I dont know about later version. You need to shrink your database. Some time shirnk option does not help much. try following steps. Keep backup of whole database before doing anything. HOW TO DELETE/REDUCE LOG FILE SIZE IN SQL SERVER … | |
Re: I have some doubt Exactly what do you want? Do you have column for checkbox say yes/no or 0/1 in central table ? If user checks the check box of some row, then submits the form what you want to do? do you want to reflect check values in database … | |
Re: [code] <?php $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db('mydb'); mysql_query("INSERT INTO userinfo (col1) values ('value1')"); $keyid= mysql_insert_id()); mysql_query("INSERT INTO auth_user (uid,col1) values ('{$keyid}','value1')"); ?> [/code] | |
Re: Try following code [code] <?php $headers= "MIME-Version: 1.0\n"; $headers.="Content-type: [b]text/html;[/b] charset=iso-8859-1\n"; $headers.="cc: cc@daniweb.com\n"; $tomail="tosomeone@daniweb.com"; $message="<bold>This is message for email</bold>\n\n<br><br>"; $message.="<i>Nb : This message may be written in complete html format .</i>"; mail($tomail,"This is mail subject ",$message,$headers); ?> [/code] | |
Re: I think there is not problem in keeping 2 separate files especially when you code is so lengthy. I am not able to understand that what problem you are facing with 2 separate files. In your merged file there is some problem with php braces{} one end brace is missing. … | |
Re: If you are using "select * " then change the query, you must specifically select the columns you want in your view from various tables. If still two columns from diffrerent table has same name then give alias to one of them. | |
Re: what is the actual problem, Your query is giving error or giving unexpected result | |
Re: Make changes highligted below [code] $sql = "SELECT d.title, d.mktime, COUNT(r.id) FROM documents AS d LEFT JOIN clickreg AS r ON r.docid = d.id [b]group by d.title, d.mktime [/b]" [/code] | |
Re: make the change in your query as hightligted below [code] $data = "UPDATE inventors SET month='$month', day='$day', year='$year', [b]date='{$year}-{$month}-{$day}'[/b] WHERE lastname=".'"'.$lastname.'"'; [/code] | |
Re: try following code [code] $B_insert = "INSERT INTO B (B_add, B_pcode) VALUES ('$val_add', '$val_pcode')"; $result = mysql_query($B_insert) or die (mysql_error()); [B]$bid=mysql_insert_id();[/B] $C_insert = "INSERT INTO C (C_state) VALUES ('$val_state')"; $result = mysql_query($C_insert) or die (mysql_error()); [B]$cid=mysql_insert_id();[/B] $A_insert = "INSERT INTO A (A_fname, B_id, C_id) VALUES ('$val_fname', [B]'{$bid}', '{$cid}'[/B])"; $result = … | |
Re: Following query should work I m assuming that both table contains year column [code] select sum(elec.votes)/sum(stat.rating) as percentage from elec inner join on elec.year=stat.year where stat.year=2009 [/code] | |
Re: Change your function as shown below [code] function newField() { document.getElementById('container').innerHTML = '<div id="myFile" style="width:100px;overflow:hidden;border:thin solid" title='' + document.getElementById('myFile').innerHTML+ ''>thisisaverylongfilename.jpg</div>'; } [/code] You may use document.getElementById('myFile').innerText | |
Re: You may follow steps given below. Still if you are not getting out of the problem then paste your code here. 1) The page in which you have written fpdf code for generating pdf, make sure there is no space or enter mark before and after php tags. 2) start … | |
![]() | Re: Please post your table sturcture of both tables. also specify the primary key and foriegin key ![]() |
Re: if your domain name is [url]http://www.yoursite.com/somepage[/url] then now try it without www http:/yoursite.com/somepage | |
Re: 1) Check whether your template file contains @FCC_BODY@ text or not 2) open you database (may be phpmyadmin) and execute your query, whether it gives result or not. "SELECT * FROM articles WHERE show = 'yes'" | |
Re: Try following query [code] select et.equipment_type, max(case when name='Managed_Ip' then value end) as SNMP_port, e.equipment_name as equipment_name, [B]cs.customer_name[/B] from equipment_feature ef inner join equipments e on(e.equipment_id=ef.equipment_id) inner join equipment_types et on (e.equipment_type_id=et.equipment_type_id) inner join [B](select 'customer_id' colname,customer_id,customer_name from customer union select 'site_id' colname,site_id as customer_id, site_name as customer_name from site) … | |
Re: You can use FPDF library Download its zip file from net. I don't remember the link. If you dont find it. tell me i wll send you its zip folder. following is the sample code to generate pdf for php code. Here code is reading data from file, you can … | |
Re: You can concate your query string conditionally [code]$query = "your query "; if (your condition =true) { $query=$query." your more condition"; } execute_query($query);[/code] | |
Re: product_name varchar(50), product_type char(1),//C for category and I for ITEM price numeric(8,2) [B]product_level[/B] parent_id numeric(5), child_id numeric(5), level numeric(2) example of PRODUCT_MASTER TABLE PRODUCT_ID, PRODUCT_NAME, PRODUCT_TYPE, PRICE 0 , 'PRODUCTS', 'C',NULL //ROOT NODE 1, 'CATE 1','C', NULL // CATEGORY 1 2, 'CATE 2' ,'C', NULL // CATEOGORY 2 3, 'CATE … | |
Re: I have a question why you chose to create 3 separate tables for Stock, bond and mutual funds. According to me you can create one table with same columns and one more column say stock_type (Stock,Bond,Mutal), you can also create one master table for stock type so that, in future … | |
Re: I dont know the actual method but I think following may work. [code] str_replace("code","<span style='your style'>",$yourtext); str_replace("/code","</span>",$yourtext); [/code] You mus use full tag in your code i.e. \[code\] | |
Re: Ramy is right, that you must create another table for detail and then you need to join them. But if you like to continue with this design then you have to use union keyword to get your result. I Dont know about the performance, [code] select game,count(*) total from (select … | |
Re: Try following code [code] <html> <script lang='javascript'> var checkedcount=0; function validate() { if (checkedcount<=0 || checkedcount>4 ) { alert('Select one to four options!'); return false; } } function checkinfo(chkbox) { if(chkbox.checked==true) checkedcount++; else checkedcount--; } </script> <body> <form name=frm action=some.php method=post> <input type=checkbox id=chk[0] name=chk[0] value=0 onclick='javascript:checkinfo(this);' > Option 0<br> … | |
Re: This is many to many relation ship. So instead of creating page for account_course table, you should allow user to enter students for course in course entry page, and allow user to enter course for students in student entry page. I mean header detail kind of form. I hope I … | |
Re: You must add hidden field on confimation page [code] <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> Your choice: <input type="radio" name="choice" value="yes"> Yes <input type="radio" name="choice" value="no" /> No [B]<input type="hidden" name="mGinNo" id="mGinNo" value="<?php echo $_REQUEST['mGinNo'];?>"> [/B] <button type="submit">Send</button> </form> [/code] | |
Re: [code] print'<option value="{$nt[ugname]}">'.$nt[ugname].''; print'</option>'; [/code] If you have any key column other than ugname then you can use that as value. | |
Re: Call logout.php I am assuming that you have written code for deletion in logout.php [code=php]define onUnload() { window.location ='logout.php'; }[/code] | |
Re: Try following javscript code in your all html page in the begining and see what happens. If you have many pages then you can keep following code in one javascript file and then just refer that file from every html page. You need not to use php for this. [code] … | |
Re: I think you need not to check if you have created constraints properly. But still if you want to check, then to chekc PK try to insert record with existing PK value, and to check FK try to insert record with FK value that does not exist in master table … | |
Re: I think your code has little problem, try following: [code] <?php $uidTotal = mysql_connect("localhost", "user", "pass"); mysql_select_db("table", $uidTotal); [B]$uid=3;[/B] $result = mysql_query("SELECT * FROM tracking WHERE uid = [B]{$uid}[/B]", $uidTotal); $a = mysql_num_rows($result); echo "[B]{$a}[/B] \n"; ?> [/code] | |
Re: You can try following, but I am not able to understand what is id in "parent_id=id". [code] insert into categories(....) values select 1,'aaa','some text', parent_id date,date from categories where parent_id=id; [/code] Are you going to execute above query in php or mysql directly? | |
Re: Please define your problem more precisely and with example. | |
Re: Your syntax is working fine it has no problem. If you are getting an error then post that error message. | |
Re: following query will give ids of product which have invetory column's value as 0 [ICODE]select distinct idproduct where inventory=0 from optionsInventory[/ICODE] follwing query deletes all product records which do not have invertory column value as 0 [ICODE]delete from optionsInventory where idproduct not in ( select distinct idproduct where inventory=0 from … | |
Re: Please post the exact case with table structure and trigger code. | |
Re: [QUOTE]$dbname = "cvarcher_members"; [/QUOTE] 1) Are you sure about spelling of "varchar"? 2) Have echoed query that is $update variable before executing then exectuted in phpmyadmin sql section? Do not use dummy resolve actual query by echoing $update before exeuting in php. |
The End.