1,257 Posted Topics

Member Avatar for R3Slick

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 …

Member Avatar for venkat0904
0
159
Member Avatar for kiranhg.2008

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; …

Member Avatar for kiranhg.2008
-2
73
Member Avatar for iann
Member Avatar for questionary

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.

Member Avatar for MeSampath
0
149
Member Avatar for ratatu

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 …

Member Avatar for ratatu
0
80
Member Avatar for studioceasar

set @counter:=6000; select *, @counter:=(@counter +1) rownum from tablename;

Member Avatar for sonikadugar
0
85
Member Avatar for bandibas

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]

Member Avatar for baki100
0
65
Member Avatar for muralibobby2015

[code] $result = mysql_query("SELECT name FROM user WHERE month(dob) = '$current_month' AND day(dob) >= '$current_day' ") [/code]

Member Avatar for venkat0904
-1
89
Member Avatar for xirosen

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 …

Member Avatar for xirosen
0
132
Member Avatar for vuyiswamb
Member Avatar for ayesha789

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 …

Member Avatar for ayesha789
0
105
Member Avatar for Nuw2php

[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]

Member Avatar for Nuw2php
0
114
Member Avatar for SKANK!!!!!

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]

Member Avatar for SKANK!!!!!
0
136
Member Avatar for motieno

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. …

Member Avatar for network18
0
655
Member Avatar for ireverent

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.

Member Avatar for urtrivedi
0
85
Member Avatar for _taz_

what is the actual problem, Your query is giving error or giving unexpected result

Member Avatar for _taz_
0
173
Member Avatar for lifeworks

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]

Member Avatar for urtrivedi
0
68
Member Avatar for levsha

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]

Member Avatar for levsha
0
76
Member Avatar for futhonguy

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 = …

Member Avatar for futhonguy
0
190
Member Avatar for jrosh

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]

Member Avatar for jrosh
0
100
Member Avatar for Altairzq

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

Member Avatar for Jupiter 2
0
270
Member Avatar for aditi_19

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 …

Member Avatar for urtrivedi
0
7K
Member Avatar for Peric

Please post your table sturcture of both tables. also specify the primary key and foriegin key

Member Avatar for Peric
0
238
Member Avatar for just asif
Member Avatar for mbirame

if your domain name is [url]http://www.yoursite.com/somepage[/url] then now try it without www http:/yoursite.com/somepage

Member Avatar for Josh Connerty
0
98
Member Avatar for mcatominey

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'"

Member Avatar for mcatominey
0
96
Member Avatar for navarannan

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) …

Member Avatar for urtrivedi
0
85
Member Avatar for nikhita

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 …

Member Avatar for peter_budo
0
2K
Member Avatar for veledrom
Member Avatar for SoniaBaby

You can concate your query string conditionally [code]$query = "your query "; if (your condition =true) { $query=$query." your more condition"; } execute_query($query);[/code]

Member Avatar for urtrivedi
0
118
Member Avatar for aida21

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 …

Member Avatar for ithelp
0
78
Member Avatar for mikeandike22

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 …

Member Avatar for mikeandike22
0
168
Member Avatar for Shanti C

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\]

Member Avatar for Shanti C
-1
149
Member Avatar for yuri1992

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 …

Member Avatar for Ramy Mahrous
0
100
Member Avatar for queenc

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> …

Member Avatar for BzzBee
0
173
Member Avatar for cjwenigma

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 …

Member Avatar for rm_daniweb
0
207
Member Avatar for trtcom1

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]

Member Avatar for rm_daniweb
0
1K
Member Avatar for vidhyaponnusamy

[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.

Member Avatar for rm_daniweb
0
169
Member Avatar for akash_msrit

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]

Member Avatar for urtrivedi
0
137
Member Avatar for shahzadhard
Member Avatar for chellethecat

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] …

Member Avatar for MidiMagic
0
118
Member Avatar for queenc
Member Avatar for srpa01red

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 …

Member Avatar for darkagn
0
70
Member Avatar for changeco

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]

Member Avatar for changeco
0
153
Member Avatar for srpa01red

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?

Member Avatar for saurav.prasad28
0
98
Member Avatar for dude1
Member Avatar for nav33n
0
99
Member Avatar for lacompsr

Your syntax is working fine it has no problem. If you are getting an error then post that error message.

Member Avatar for urtrivedi
0
76
Member Avatar for pezza

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 …

Member Avatar for pezza
0
111
Member Avatar for drynish
Member Avatar for drynish
0
118
Member Avatar for cvarcher

[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.

Member Avatar for cvarcher
0
123

The End.