<?xml version="1.0" encoding="iso-8859-1" ?>
<rss version="2.0">
<channel>
	<title>w3schools.com - SQL Forum</title>
	<description>The complete discussion board conversation RSS Feed - SQL</description>
	<link>http://w3schools.invisionzone.com/index.php</link>
	<pubDate>Sun, 22 Nov 2009 19:18:39 -0500</pubDate>
	<ttl>5</ttl>
	<item>
		<title><![CDATA[Php Include & Variables]]></title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28672</link>
		<description><![CDATA[I've been trying to generate a php include, using data from my database, but am not getting the effect I was expecting.  The current result can be found at: <a href="http://www.equinefocus.co.uk/random/0345gdfg/trialcode.php" target="_blank">http://www.equinefocus.co.uk/random/0345gdfg/trialcode.php</a><br /><br />The code currently in use is:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->&nbsp;&nbsp;&nbsp;&nbsp;&#60;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$data = mysql_query &#40;&#34;SELECT * FROM ***** WHERE ref='001'&#34;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&#40;$info = mysql_fetch_array&#40;$data&#41;&#41; {&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;// data<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$url='/random/0345gdfg/filters/'.$info&#91;'url'&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$addstats='/random/0345gdfg/filters/'.$info&#91;'urla'&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />?&#62;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#60;table border=&#34;1&#34; cellpadding=&#34;5&#34; cellspacing=&#34;0&#34; width=&#34;50%&#34; align=&#34;center&#34;&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#60;tr&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#60;td width='60%' bgcolor='silver'&#62;&#60;a href=&#34;&#60;?php echo $url;?&#62;&#34;&#62;&#60;?php echo $info&#91;'filter'&#93;; ?&#62;&#60;/a&#62;&#60;/td&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#60;td width='40%'&#62;&#60;?php include&#40;$addstats&#41;;?&#62;&#60;/td&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#60;/tr&#62;&#60;/table&#62;<br /><br />&#60;?php<br />}&nbsp;&nbsp;<br />?&#62;<!--c2--></div><!--ec2--><br /><br />I attach a pdf file showing a small section of my database: <a href="http://www.equinefocus.co.uk/random/0345gdfg/filters/20091121.pdf" target="_blank">http://www.equinefocus.co.uk/random/0345gd...rs/20091121.pdf</a>.  <br /><br />The PHP include file pulls in stats for each filter, code of which is below.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->&#60;?php include&#40;$_SERVER&#91;'DOCUMENT_ROOT'&#93;.'/random/0345gdfg/*****.php'&#41;;?&#62;<br /><br />&#60;table border=&#34;0&#34; cellpadding=&#34;2&#34; cellspacing=&#34;0&#34; width=&#34;100%&#34;&#62;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#60;td width=&#34;25%&#34;&#62;&#60;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query = &#34;SELECT SUM&#40;profit&#41; FROM *****&#34;; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$result = mysql_query&#40;$query&#41; or die&#40;mysql_error&#40;&#41;&#41;;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Print out result<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&#40;$row = mysql_fetch_array&#40;$result&#41;&#41;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo $row&#91;'SUM&#40;profit&#41;'&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;&#60;br /&#62;&#34;;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;?&#62;&#60;/td&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#60;td width=&#34;25%&#34;&#62;&#60;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query = &#34;SELECT COUNT&#40;horse&#41; FROM ***** WHERE pos ='1'&#34;; <br />&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$result = mysql_query&#40;$query&#41; or die&#40;mysql_error&#40;&#41;&#41;;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;// Print out result<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&#40;$row = mysql_fetch_array&#40;$result&#41;&#41;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo $row&#91;'COUNT&#40;horse&#41;'&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo $row&#91;'type'&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;&#60;br /&#62;&#34;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?&#62;&#60;/td&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#60;td width=&#34;25%&#34;&#62;&#60;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query = &#34;SELECT COUNT&#40;horse&#41; FROM *****&#34;; <br />&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$result = mysql_query&#40;$query&#41; or die&#40;mysql_error&#40;&#41;&#41;;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;// Print out result<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&#40;$row = mysql_fetch_array&#40;$result&#41;&#41;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;Number of qualifers&#58;&#34;. $row&#91;'COUNT&#40;horse&#41;'&#93; .&#34; &#34;. $row&#91;'type'&#93; .&#34;&#34;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;&#60;br /&#62;&#34;;<br />}<br />?&#62;&#60;/td&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;&#60;/tr&#62;<br />&#60;/table&#62;<!--c2--></div><!--ec2-->  <br /><br />If there are better ideas on how I can generate this information in a more effective manner, please do let me know!]]></description>
		<pubDate>Sat, 21 Nov 2009 16:28:40 -0500</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28672</guid>
	</item>
	<item>
		<title>Trouble With Joins</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28638</link>
		<description><![CDATA[Hello.<br /><br />For a website I'm making, in order to register, you must know someone that is already registered. Checking to make sure that the "referrer" they entered into the registration field is actually a user is easy enough:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->SELECT firstName, lastName FROM users WHERE firstName = '$refFirstName' && lastName = '$refLastName';<!--c2--></div><!--ec2--><br /><br />Where <i>$refFirstName</i> and <i>$refLastName</i> are the referrer's first and last names, respectively.<br /><br /><a href="http://i48.tinypic.com/5arekl.jpg" target="_blank">Here is the layout of the database</a>.<br /><br />Because it is a "private" site (i.e. a limited user base), I was going to make a page that displays all the users and the person that referred them. Simply put, I have no idea how to do it. In the <i>referrers</i> table, <i>refID</i> is always equal to <i>userID</i>. I cannot figure out a way to get the <u>NAME</u> of a user's referrer out of the database in the same SELECT query as everything else. Would I use a LEFT JOIN or INNER JOIN, or something else? Also, is there anyway to combine the <i>referrer</i> table into the <i>user</i> one? <br /><br />Thanks!]]></description>
		<pubDate>Wed, 18 Nov 2009 20:18:59 -0500</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28638</guid>
	</item>
	<item>
		<title>Which One Is Suit For Good Job?</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28522</link>
		<description><![CDATA[I got learned that Microsoft's SQL Sever, MySQL, and MyOracle are the most popular SEVER scripting language applicated widely now!<br /><br />as a beginner, I want to choose one of them for my career in future. <br /><br />besides, whether Microsoft's SQL Sever and MySQL have the similar SQL language?<br /><br />any experts who can guide me?<br /><br />thanks a lot]]></description>
		<pubDate>Tue, 10 Nov 2009 22:27:13 -0500</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28522</guid>
	</item>
	<item>
		<title>Cannot Perform An Aggregate Function...</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28500</link>
		<description><![CDATA[Hi all,<br /><br />I have a procedure as below;<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->ALTER PROCEDURE &#91;dbo&#93;.&#91;GetActivePeriod&#93;<br />AS<br /> <br />SELECT&nbsp;&nbsp;w.WorkKeeper, SUM &#40;DATEDIFF &#40;ss, a.ProcessDate, MIN&#40;b.ProcessDate&#41; &#41; &#41; AS 'ActivePeriod' <br /><br />FROM Work w, ProcessLog a INNER JOIN ProcessLog b ON &#40;b.ProcessId &#62; a.ProcessId AND b.WorkId=a.WorkId&#41;<br /><br />WHERE CONVERT&#40; varchar&#40;10&#41;, a.ProcessDate, 111&#41; = CONVERT&#40; varchar&#40;10&#41;, GETDATE&#40;&#41;, 111&#41;<br />AND CONVERT&#40; varchar&#40;10&#41;, b.ProcessDate, 111&#41; = CONVERT&#40; varchar&#40;10&#41;, GETDATE&#40;&#41;, 111&#41;<br />AND a.ProcessNum=1<br />AND &#40; b.ProcessNum=2 OR b.ProcessNum=4 OR b.ProcessNum=5 OR b.ProcessNum=6 &#41;<br />AND w.WorkId=a.WorkId<br /><br />GROUP BY w.WorkKeeper<!--c2--></div><!--ec2--><br /><br />And I get this error, "Cannot perform an aggregate function on an expression containing an aggregate or a subquery." When I remove <b>MIN</b>, it sums all the rows that matches the criteria <img src="http://w3schools.invisionzone.com/style_emoticons/default/sorry.gif" style="vertical-align:middle" emoid=":sorry:" border="0" alt="sorry.gif" /> , but I only want the one with min ProcessDate. <br /><br />Could you please help me?<br /><br />Thanks.]]></description>
		<pubDate>Mon, 09 Nov 2009 08:22:00 -0500</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28500</guid>
	</item>
	<item>
		<title>Gridlines Not Showing Up On Sql Services Report</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28484</link>
		<description><![CDATA[I created a SQL Services Report using MS Visual Studio from an existing report. The existing report shows the gridlines when I select the 'preview' tab and also when I open the report on the server, however, the newly created report doesn't show the gridlines on the 'preview' tab or when I open it up on the server. <br /><br />I've checked the properties section and everywhere else in the application, but have not found where the option is located so that I can get the gridlines to appear within the report.<br /><br />Anyone having any suggestions or can point me in the right direction is greatly appreciated and welcomed.<br /><br />Thanks!]]></description>
		<pubDate>Fri, 06 Nov 2009 22:53:41 -0500</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28484</guid>
	</item>
	<item>
		<title>Newbie Going Out Of His Mind</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28481</link>
		<description><![CDATA[I am using a windows pc with xampp and I am trying to import a sql file into a mysql database through the terminal and I have looked through various forums and have came up with nothing this is what I have been using, I have tried log in the terminal and while logged out and it dosen't work , it say syntax error while I am logged in and when I try it when I am logged out it says It can't find the file even through I put in the full path name C:&#092;mysql&#092;data&#092;query_file.sql<br /><br /><!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->mysql -u username -ppassword &lt; query_file.sql<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br /><br />Hope someone can help]]></description>
		<pubDate>Fri, 06 Nov 2009 21:21:39 -0500</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28481</guid>
	</item>
	<item>
		<title>Database Over Counties And Cities?</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28459</link>
		<description><![CDATA[Hello!<br /><br />Where can i fetch data from an database over cities, counties and maybee municipalities so i don't have to write my own database for a whole coutry.<br /><br />thanks.]]></description>
		<pubDate>Thu, 05 Nov 2009 06:12:40 -0500</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28459</guid>
	</item>
	<item>
		<title>Selecting Records Within A Date Range</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28429</link>
		<description><![CDATA[This is using mysql.<br /><br />A table contains records with a start date and an end date (used to indicate when a service was provided).  Each record has a start date but may have a null end date if the service is ongoing.  The dates are stored in the standard 2009-06-20 format.<br /><br />What I'm trying to do is produce a query to pick out records that were provided with a service between two dates eg 2009-05-01 to 2009-05-31, but it appears to be more complicated than I thought.<br /><br />The fields are called &#96;start&#96; and &#96;end&#96;, the dates for the query are called $rsd (report start date) and $red (report end date).<br /><br />Suppose a record has start and end dates of 2009-06-20 to 2009-08-13.  Running a report for 2009-05-01 to 2009-05-31 should not pick out this record.  Using dates 2009-06-01 to 2009-06-30 WILL pick it out, as will 2009-08-01 to 2009-08-31 etc.  Running a report for 2009-09-01 to 2009-09-30 should not pick it out.<br /><br />It gets more complicated when the report dates fall completely within the record's dates eg running a report for 2009-07-08 to 2009-07-14, and also if the record's end date is null.<br /><br />I've been trying to write a select query using where... and/or... for every conceivable scenario but I'm sure there must be an easier way - perhaps by excluding records that don't fall within the dates, rather than trying to select records that do match?<br /><br />Can anyone help me?  Perhaps someone has already written such a query?]]></description>
		<pubDate>Mon, 02 Nov 2009 20:12:38 -0500</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28429</guid>
	</item>
	<item>
		<title>Sql Error...on Inserting Record</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28413</link>
		<description><![CDATA[table scrap has these columns...<br />id(autoincrement),scrapfrom(number),time(number),scrapto(number),message(text)<br /><br />i had executed this query<br />INSERT INTO scrap (scrapfrom,time,scrapto,message) VALUES (1,1257148511,1,'Hellow akdkjlasdkjlsaasdkjl')<br /><br />and the following error came...<br /><b>Warning</b>: odbc_exec() [<a href="http://localhost/php_new/function.odbc-exec" target="_blank">function.odbc-exec</a>]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement., SQL state 37000 in SQLExecDirect in <b>C:&#092;Inetpub&#092;wwwroot&#092;php_new&#092;scrap.php</b> on line <b>24</b><br /><br />please help me with this...<br />i am using access database....<br /><br />]]></description>
		<pubDate>Sun, 01 Nov 2009 23:37:17 -0500</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28413</guid>
	</item>
	<item>
		<title>Alternative To Trigger_error And Die?</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28363</link>
		<description><![CDATA[I run a query and as I will put it live shortly want only to output a customer-friendly message with all the content below that there normally is. 'mysql_query o trigger_error will show error message, so this is a no no. Alternatively 'mysql_query or die' won't display the bottom content. What is best to do?<br /><br />Son]]></description>
		<pubDate>Thu, 29 Oct 2009 05:31:12 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28363</guid>
	</item>
	<item>
		<title>One Query, Two While Loops?</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28345</link>
		<description><![CDATA[I have a query and would like to go twice through returned data (show data in different format). Is this not possible with same query? The first while shows nicely all info, the second one does not. The code is:<br /><div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>$query = "SELECT finish_id, finish, img FROM finishes WHERE range_id  = $prange";<br />		$result = mysqli_query ($dbc, query);<br />		<br />			if (mysqli_num_rows($finish_result) &gt; 0)<br />			{<br />			echo "&lt;select name=&#092;"fn&#092;" id=&#092;"fn&#092;"&gt;";<br />			echo "&lt;option value=&#092;"0&#092;"&gt;Select finish&lt;/option&gt;";<br />				while ($row = mysqli_fetch_array ($finish_result, MYSQLI_ASSOC))<br />				{<br />				$finish_id = $row['finish_id'];<br />				$finish = $row['finish'];<br />				echo "&lt;option value=&#092;"" . $finish_id . "&#092;"";<br />				echo "&gt;" . $finish . "&lt;/option&gt;";<br />				}<br />				echo "&lt;/select&gt; ";<br />				while ($row = mysqli_fetch_array ($finish_result, MYSQLI_ASSOC))<br />				{<br />				$finish_id = $row['finish_id'];<br />				$finish = $row['finish'];<br />				$img = $row['img'];<br />				$finishImgPath = "assets/finishes/preview/";<br />				$size = getimagesize("assets/finishes/preview/{$img}");<br />				echo "&lt;img src=&#092;"" . $mainPath . $finishImgPath . $img . "&#092;" " . $size[3] . " alt=&#092;"" . $finish . "&#092;" title=&#092;"" . $finish . "&#092;" /&gt;&lt;/a&gt;";<br />				}<br />			}</div><br /><br />Do I have to run the query twice?<br /><br />Son]]></description>
		<pubDate>Wed, 28 Oct 2009 07:52:20 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28345</guid>
	</item>
	<item>
		<title>Mysql Select Date Selection</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28337</link>
		<description><![CDATA[I am trying to select the 31 most recent dates from a database, the problem is that <u>if</u> the last date to be selected (the furthest back in time) is not the only entry with that the date then I either don't want to select it or I want to select the other dates that match it as well(depending on which is easier).<br />Any ideas?]]></description>
		<pubDate>Tue, 27 Oct 2009 17:09:31 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28337</guid>
	</item>
	<item>
		<title>Sql Report Extremely Slow To Display Results</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28335</link>
		<description><![CDATA[After modifying a SQL report to display any user(s) that have an MR status of 'canceled', I am noticing that when the report is executed on the server, it's taking so long to display that it has timed out on several occasions. <br /><br />I've been trying to speed the process of viewing the report, but without any success.<br /><br />See code below for details....<br /><div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>USE [SQL_reporting]<br />GO<br />/****** Object:  StoredProcedure [dbo].[pp_Material_Request_CANCELED_byUser]    Script Date: 10/27/2009 12:32:31 ******/<br />SET ANSI_NULLS ON<br />GO<br />SET QUOTED_IDENTIFIER ON<br />GO<br />-- ==================================================<br />-- Author:		&lt;me&gt;<br />-- Modified:	&lt;me&gt;<br />-- Create date:          &lt;7/30/2008&gt;<br />-- Description:	[pp_Material_Request_CANCELED_byUser]<br />-- ==================================================<br /><br />ALTER PROCEDURE [dbo].[pp_Material_Request_CANCELED_byUser]<br />(<br />		@facility varchar(10), @USER_VAL varchar(5000)		 <br />)<br /><br />AS<br /><br />SET NOCOUNT ON<br />SET ANSI_NULLS ON<br /><br />DECLARE @connection_string As varchar(50)<br />SET @connection_string = dbo.linked_server(@facility)<br />--use the @connection_string variable in your calls for<br />--openquery('+@connection_string+',<br />SET @facility = dbo.change_BRE_to_BR(@facility)<br /><br />-- end lines<br /><br /><br />SET @USER_VAL = dbo.format_string(@USER_VAL)<br /><br /><br />DECLARE @SQL VARCHAR(8000)	<br />	SET @SQL = '<br />	SELECT tidmrmst.material_request, tidmrmst.matl_request_type,<br />       tidmrmst.mr_status, tidmrmst.need_date_matl, tidmrmst.status_date,<br />       tidmrmst.resp_id, tidmrmst.job_type, tidmrmst.reference_type,<br />       tidmrmst.reference_nbr, tidmrmst.reference_sub_nbr, tidmrmst.title,<br />       lower(ltrim(rtrim(tidprefs.preference_value))) ||''@''||<br />       lower(ltrim(rtrim(tidprefs1.preference_value))) As email,<br />       rtrim(tidemplo.first_name) || '' '' || ltrim(tidemplo.last_name) As name<br /> <br /> FROM cb10.tidmrmst, cb10.tidprefs, cb10.tidprefs tidprefs1, tidemplo<br /> WHERE (<br />    (tidmrmst.resp_id IN ('+@USER_VAL+'))<br />   AND (tidmrmst.facility = '''+@facility+''')<br />   AND ((tidmrmst.mr_status = ''CANCELED''))<br />   AND ((tidmrmst.resp_id = tidemplo.passport))<br />   AND ((tidmrmst.resp_id = tidprefs.pref_qual_value (+)))<br />   AND ((tidmrmst.resp_id = tidprefs1.pref_qual_value (+)))<br />   AND ((tidprefs.preference_name = ''EMAIL USER ID''))<br />   AND ((tidprefs1.preference_name = ''EMAIL USER NETADDR''))<br />   )<br /> ORDER BY tidmrmst.resp_id'<br /><br />SET @SQL = 'select * from openquery('+@connection_string+',''' + REPLACE(@SQL,'''','''''') + ''')'<br />EXEC (@SQL)<br /><br />SET NOCOUNT OFF</div><br /><br />Any help and or suggetions is greatly appreciated! <br /><br />Thanks!]]></description>
		<pubDate>Tue, 27 Oct 2009 13:42:00 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28335</guid>
	</item>
	<item>
		<title>Order By Syntax Issue</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28316</link>
		<description><![CDATA[I cannot get the ORDER BY syntax right on my query. I have:<br /><div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>SELECT product_id, product, img1 FROM products WHERE product_id IN (SELECT product_id FROM productCat WHERE category_id = 9)  ORDER BY (SELECT usort FROM productCat)</div><br /><br />Products should be ordered by the column usort in productCat table. How would I do this correctly?<br /><br />Son]]></description>
		<pubDate>Mon, 26 Oct 2009 12:21:08 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28316</guid>
	</item>
	<item>
		<title>Multiple Queries On One Page</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28278</link>
		<description><![CDATA[I have a mini racing system, and I'd like to run several filters on the data to gauge where the more profitable areas are (if they exist!)  I thought I might be able to use php/mysql to query the data - I thought that the profit/loss number of winners would be automatically updated each time I upload more data.<br /><br />My code currently looks like this:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->&#60;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;// Make a MySQL Connection<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mysql_connect&#40;&#34;*****&#34;, &#34;*****&#34;, &#34;*****&#34;&#41; or die&#40;mysql_error&#40;&#41;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mysql_select_db&#40;&#34;******&#34;&#41; or die&#40;mysql_error&#40;&#41;&#41;;<br />?&#62;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&#60;table border=&#34;1&#34; cellpadding=&#34;2&#34; cellspacing=&#34;0&#34; width=&#34;100%&#34;&#62;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#60;tr&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#60;td width=&#34;25%&#34;&#62;No Filter&#60;/td&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#60;td width=&#34;25%&#34;&#62;&#60;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query = &#34;SELECT SUM&#40;profit&#41; FROM *****&#34;; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$result = mysql_query&#40;$query&#41; or die&#40;mysql_error&#40;&#41;&#41;;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Print out result<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&#40;$row = mysql_fetch_array&#40;$result&#41;&#41;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo $row&#91;'SUM&#40;profit&#41;'&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;&#60;br /&#62;&#34;;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;?&#62;&#60;/td&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#60;td width=&#34;25%&#34;&#62;&#60;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query = &#34;SELECT COUNT&#40;horse&#41; FROM ***** WHERE pos ='1'&#34;; <br />&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$result = mysql_query&#40;$query&#41; or die&#40;mysql_error&#40;&#41;&#41;;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;// Print out result<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&#40;$row = mysql_fetch_array&#40;$result&#41;&#41;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;Number of winners&#58;&#34;. $row&#91;'COUNT&#40;horse&#41;'&#93; .&#34; &#34;. $row&#91;'type'&#93; .&#34;&#34;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;&#60;br /&#62;&#34;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?&#62;&#60;/td&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#60;td width=&#34;25%&#34;&#62;&#60;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query = &#34;SELECT COUNT&#40;horse&#41; FROM *****&#34;; <br />&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$result = mysql_query&#40;$query&#41; or die&#40;mysql_error&#40;&#41;&#41;;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;// Print out result<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&#40;$row = mysql_fetch_array&#40;$result&#41;&#41;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;Number of qualifers&#58;&#34;. $row&#91;'COUNT&#40;horse&#41;'&#93; .&#34; &#34;. $row&#91;'type'&#93; .&#34;&#34;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;&#60;br /&#62;&#34;;<br />}<br />?&#62;&#60;/td&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;&#60;/tr&#62;<br />&#60;/table&#62;<!--c2--></div><!--ec2--><br /><br />The plan is to have 30+ different filters for this data - can you see a suitable method for displaying this as a single table, or will I have to repeat the above code 30ish times?  Any advice appreciated, as always!]]></description>
		<pubDate>Fri, 23 Oct 2009 14:54:54 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28278</guid>
	</item>
	<item>
		<title>Need An Sql Statement For This...</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28276</link>
		<description><![CDATA[My table consist of following columns...<br />id(auto_increment),scrapto(int),scrapfrom(int),time(date/time),date(date/time),message(text)<br /><br />where scrapto and scrapfrom consists of member's id.<br />i want to pick up latest scraps of any member..<br />how can i do this...i thought i will first pick up all scraps of specific member ordered by date...but the problem is i also want to order them by time..how can i do both things ...is there any function in php through which i can sort the result which came out of an query... <br />thanks...]]></description>
		<pubDate>Fri, 23 Oct 2009 13:57:15 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28276</guid>
	</item>
	<item>
		<title>Tables In  Mysql</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28269</link>
		<description><![CDATA[i would like to know what type,collation,chatacteristics,null ,e.t.c.  we put for  radio button and  checkbox in the tables of mysql databases that we have made parallels plesk control panel. <br />thanks]]></description>
		<pubDate>Fri, 23 Oct 2009 05:47:24 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28269</guid>
	</item>
	<item>
		<title>Need Explanation And Help</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28263</link>
		<description><![CDATA[Hi guys, i am attached to a property company. Recently i wish to extract data to find agents who has received more than the minimum percent commission. The table AGENT has 5% as the minimum percent commission<br /><br />I do the following statement Select agent_ID from AGENT where percent &gt; 5; and it failed. May i know why?<br /><br /><br />Secondly, why the NOT IN and &lt;&gt;ANY(not equal any) do not have the same effect, however &lt;&gt;ALL is equivalent to NOT IN.. why is that so? <img src="http://w3schools.invisionzone.com/style_emoticons/default/umnik2.gif" style="vertical-align:middle" emoid=":umnik2:" border="0" alt="umnik2.gif" />]]></description>
		<pubDate>Thu, 22 Oct 2009 22:31:47 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28263</guid>
	</item>
	<item>
		<title>Order By Number Of Entries</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28256</link>
		<description><![CDATA[Currently I am attempting to pull some data using:<br />$sql="select * from inspect_erp where inspection_id  = ".$myid." ORDER BY erp_type";<br /><br />the fields in the table are<br />erp_id, inspection_id, 	erp_type, gpslocation<br /><br />Basically, I am looking to alter this to have the SQL order by the most commonly occurring  erp_type to the least occuring. Can anyone help me out?]]></description>
		<pubDate>Thu, 22 Oct 2009 15:17:02 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28256</guid>
	</item>
	<item>
		<title>What Is The Best Way To Uniquely Identify Members?</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28252</link>
		<description><![CDATA[I usually have a auto increment primary key which gives members a number in the order they registered in. However for my website I decided to to generate a random unique string for every member, e.g. HN98AYCNCSDJ9KSUWD. What's the best way to identify each member?]]></description>
		<pubDate>Thu, 22 Oct 2009 12:56:52 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28252</guid>
	</item>
	<item>
		<title>Ascii Collation</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28250</link>
		<description><![CDATA[Hi,<br /><br />I think this is right place to post it.<br /><br />What's the best collation for &#269; &#263; ž š &#273;<br /><br />I've tried latin, utf8 but it's still shows me some wierd chars<br /><br />Form sends text through ajax to registration file. And I've used echo $name and chars are shown fine.<br /><br />Also I have header at top of registration file for Windows-1250<br /><br /><br />Regards<br /><br /><br />EDIT: utf8_general_ci now seems to works fine <img src="http://w3schools.invisionzone.com/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />]]></description>
		<pubDate>Thu, 22 Oct 2009 10:22:14 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28250</guid>
	</item>
	<item>
		<title>Records Keeping Duplicating In Db...</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28244</link>
		<description><![CDATA[I have a db that's supposed to have 236 records in it. For some odd reason, it suddenly has 634 and most of them are duplicates. It's as though the table is replicating itself and appending itself to the beginning of that table. I know it's the beginning because the first four hundred or so don't have the password included in any of the fields and it's not on my input form, yet. Here's my form to retrieve records from a query based on a username:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->&#60;!DOCTYPE HTML PUBLIC &#34;-//W3C//DTD HTML 4.01 Transitional//EN&#34; &#34;http&#58;//www.w3.org/TR/html4/loose.dtd&#34;&#62;<br />&#60;html xmlns=&#34;http&#58;//www.w3.org/1999/xhtml&#34; xml&#58;lang=&#34;en&#34; lang=&#34;en&#34;&#62;<br />&#60;head&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;&#60;title&#62;Edit Profile&#60;/title&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;&#60;link href=&#34;CSS/profile.css&#34; rel=&#34;stylesheet&#34; type=&#34;text/css&#34;&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;&#60;meta http-equiv=&#34;content-type&#34; content=&#34;text/html;charset=utf-8&#34;&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;&#60;meta http-equiv=&#34;Content-Style-Type&#34; content=&#34;text/css&#34;&#62;<br />&#60;/head&#62;<br />&#60;body&#62;<br />&#60;div class=&#34;centered_div&#34;&#62;<br />&#60;div class=&#34;header&#34;&#62;<br />My Will Made Easy - Attorney Profile Editor<br />&#60;/div&#62;<br />&#60;div class=&#34;profile_text&#34;&#62;<br />&#60;?php<br />$con = mysql_connect&#40;&#34;localhost&#34;,&#34;###&#34;,&#34;###&#34;&#41;;<br />if &#40;!$con&#41;<br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;die&#40;'Could not connect&#58; ' . mysql_error&#40;&#41;&#41;;<br />&nbsp;&nbsp;}<br /><br />mysql_select_db&#40;&#34;bigsilkd_attorneys&#34;, $con&#41;;<br /><br />if &#40;!empty&#40;$_POST&#91;'users'&#93;&#41;&#41;<br />{<br />&nbsp;&nbsp;$result = mysql_query&#40;'SELECT * FROM attorneys WHERE users=&#092;'' . mysql_real_escape_string&#40;$_POST&#91;'users'&#93;&#41; . '&#092;''&#41; or exit&#40;mysql_error&#40;&#41;&#41;;<br />&nbsp;&nbsp;if &#40;$row = mysql_fetch_assoc&#40;$result&#41;&#41;<br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;?&#62;<br />User Name&#58; &#60;input type=&#34;text&#34; size=&#34;20&#34; name=&#34;users&#34; value=&#34;&#60;?php echo $row&#91;'users'&#93;; ?&#62;&#34;&#62;<br />Password&#58; &#60;input type=&#34;text&#34; size=&#34;10&#34; name=&#34;password&#34; value=&#34;&#60;?php echo $row&#91;'password'&#93;; ?&#62;&#34;&#62; &#60;br /&#62;<br />Law Firm Name&#58; &#60;input type=&#34;text&#34; size=&#34;60&#34; name=&#34;LawFirmName&#34; value=&#34;&#60;?php echo $row&#91;'LawFirmName'&#93;; ?&#62;&#34;&#62; &#60;br /&#62;<br />Main Office Address&#58; &#60;input type=&#34;text&#34; size=&#34;60&#34; name=&#34;MainOfficeAddress&#34; value=&#34;&#60;?php echo $row&#91;'MainOfficeAddress'&#93;; ?&#62;&#34;&#62; &#60;br /&#62;<br />City&#58; &#60;input type=&#34;text&#34; name=&#34;MainOfficeCity&#34; value=&#34;&#60;?php echo $row&#91;'MainOfficeCity'&#93;; ?&#62;&#34;&#62;<br />ST&#58; &#60;input type=&#34;text&#34; size=&#34;3&#34; name=&#34;MainOfficeState&#34; value=&#34;&#60;?php echo $row&#91;'MainOfficeState'&#93;; ?&#62;&#34;&#62;<br />Zip&#58; &#60;input type=&#34;text&#34; size=&#34;10&#34; name=&#34;MainOfficeZip&#34; value=&#34;&#60;?php echo $row&#91;'MainOfficeZip'&#93;; ?&#62;&#34;&#62; &#60;br /&#62;<br />Main Phone&#58; &#60;input type=&#34;text&#34; name=&#34;MainOfficePhone&#34; value=&#34;&#60;?php echo $row&#91;'MainOfficePhone'&#93;; ?&#62;&#34;&#62; &#60;br /&#62;<br />Main Email Address&#58; &#60;input type=&#34;text&#34; name=&#34;MainOfficeEmail&#34; value=&#34;&#60;?php echo $row&#91;'MainOfficeEmail'&#93;; ?&#62;&#34;&#62; &#60;br /&#62;<br />Website Address&#58; &#60;input type=&#34;text&#34; size=&#34;60&#34; name=&#34;WebAddress&#34; value=&#34;&#60;?php echo $row&#91;'WebAddress'&#93;; ?&#62;&#34;&#62; &#60;br /&#62;<br />Firm Overview&#58; &#60;textarea name='Overview' rows='5' cols='40'value=&#34;&#60;?php echo $row&#91;'Overview'&#93;; ?&#62;&#34;&#62;&#60;/textarea&#62;&#60;br /&#62;<br />Years of Experience&#58; &#60;input type=&#34;text&#34; name=&#34;YearsofExperience&#34; value=&#34;&#60;?php echo $row&#91;'YearsofExperience'&#93;; ?&#62;&#34;&#62; &#60;br /&#62;<br />Languages Spoken&#58; &#60;textarea name='Languages' rows='5' cols='40'value=&#34;&#60;?php echo $row&#91;'Languages'&#93;; ?&#62;&#34;&#62;&#60;/textarea&#62;&#60;br /&#62;<br />Geographical Areas Serving&#58; &#60;textarea name='GeographiesServing' rows='5' cols='40'value=&#34;&#60;?php echo $row&#91;'GeographiesServing'&#93;; ?&#62;&#34;&#62;&#60;/textarea&#62;&#60;br /&#62;<br />Areas of Legal Practice&#58; &#60;textarea name='PracticeAreas' rows='5' cols='40'value=&#34;&#60;?php echo $row&#91;'PracticeAreas'&#93;; ?&#62;&#34;&#62;&#60;/textarea&#62;&#60;br /&#62;<br />Primary Attorney's Name&#58; &#60;input type=&#34;text&#34; name=&#34;MainAttorneyName&#34; value=&#34;&#60;?php echo $row&#91;'MainAttorneyName'&#93;; ?&#62;&#34;&#62; &#60;br /&#62;<br />Primary Attorney's Phone Number&#58; &#60;input type=&#34;text&#34; name=&#34;MainAttorneyPhone&#34; value=&#34;&#60;?php echo $row&#91;'MainAttorneyPhone'&#93;; ?&#62;&#34;&#62; &#60;br /&#62;<br />Primary Attorney's Email Address&#58; &#60;input type=&#34;text&#34; name=&#34;MainAttorneyEmail&#34; value=&#34;&#60;?php echo $row&#91;'MainAttorneyEmail'&#93;; ?&#62;&#34;&#62; &#60;br /&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;&#60;?php<br />&nbsp;&nbsp;}<br />&nbsp;&nbsp;else<br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo 'Username not found.';<br />&nbsp;&nbsp;&nbsp;&nbsp;?&#62;<br />&#60;div class=&#34;profile_text&#34;&#62;<br />&#60;form action=&#34;retrieve2.php&#34; method=&#34;post&#34;&#62;<br />&nbsp;&nbsp;User name&#58; &#60;input type=&#34;text&#34; size=&#34;90&#34; name=&#34;users&#34; value=&#34;&#60;?php echo $_POST&#91;'users'&#93;; ?&#62;&#34;&#62;<br />&#60;/form&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;&#60;?php<br />&nbsp;&nbsp;}<br />}<br />else<br />{<br />&nbsp;&nbsp;echo 'You must enter a user';<br />}<br />?&#62;<br />&#60;/div&#62;<br />&#60;/div&#62;<br />&#60;/body&#62;<br />&#60;/html&#62;<!--c2--></div><!--ec2--><br /><br />And here's what I'm using to input records:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->&#60;?php<br />$con = mysql_connect&#40;&#34;localhost&#34;,&#34;###&#34;,&#34;###&#34;&#41;;<br />if &#40;!$con&#41;<br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;die&#40;'Could not connect&#58; ' . mysql_error&#40;&#41;&#41;;<br />&nbsp;&nbsp;}<br /><br />mysql_select_db&#40;&#34;bigsilkd_attorneys&#34;, $con&#41;;<br /><br />$sql=&#34;INSERT INTO attorneys &#40;LawFirmName, MainOfficeAddress, MainOfficeCity, MainOfficeState, MainOfficeZip, MainOfficePhone, MainOfficeEmail, WebAddress, Overview, YearsofExperience, Languages, GeographiesServing, PracticeAreas, MainAttorneyName, MainAttorneyPhone, MainAttorneyEmail&#41;<br />VALUES<br />&#40;'$_POST&#91;LawFirmName&#93;','$_POST&#91;MainOfficeAddress&#93;','$_POST&#91;MainOfficeCity&#93;','$_POST&#91;MainOfficeState&#93;','$_POST&#91;MainOfficeZip&#93;','$_POST&#91;MainOfficePhone&#93;','$_POST&#91;MainOfficeEmail&#93;','$_POST&#91;WebAddress&#93;','$_POST&#91;Overview&#93;','$_POST&#91;YearsofExperience&#93;','$_POST&#91;Languages&#93;','$_POST&#91;GeographiesServing&#93;','$_POST&#91;PracticeAreas&#93;','$_POST&#91;MainAttorneyName&#93;','$_POST&#91;MainAttorneyPhone&#93;','$_POST&#91;MainAttorneyEmail&#93;'&#41;&#34;;<br /><br />if &#40;!mysql_query&#40;$sql,$con&#41;&#41;<br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;die&#40;'Error&#58; ' . mysql_error&#40;&#41;&#41;;<br />&nbsp;&nbsp;}<br />echo &#34;1 record added&#34;;<br /><br />mysql_close&#40;$con&#41;<br />?&#62;<!--c2--></div><!--ec2-->]]></description>
		<pubDate>Thu, 22 Oct 2009 01:06:40 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28244</guid>
	</item>
	<item>
		<title>Where Conditions</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28240</link>
		<description><![CDATA[The where statement can become a very trick.  It beccome even more fun when your try to create neg.  logica.  here a EG.<br /><br />In a program I might write:<br /><br /> if ( ( Products.Category = 'A' or Products.Category is Null ) or ( not ( Products.Category = 'A' or Products.Category is Null ) and (Invoices_Products.ProdAmount = 0 or Invoices_Products.ProdQty = 0 ) )...<br /><br />In this case the not ( ) make a true answer falus and a falus answer true.  Is this valid syntax for SQL?  If so is the valid for SQL 92?]]></description>
		<pubDate>Wed, 21 Oct 2009 17:13:59 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28240</guid>
	</item>
	<item>
		<title>Sql Error</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28234</link>
		<description><![CDATA[I made this query <br />$rs = odbc_exec($con, "UPDATE Data SET lastlogin='" . date("D d F, Y") . "',active=0 WHERE id=" . $id . ";");<br /><br />the error was<br /><b>Warning</b>: odbc_exec() [<a href="http://localhost/php_new/function.odbc-exec" target="_blank">function.odbc-exec</a>]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression., SQL state 22005 in SQLExecDirect in <b>C:&#092;Inetpub&#092;wwwroot&#092;php_new&#092;out.php</b> on line <b>6<br /><br />here is my database<br /></b>http://rapidshare.com/files/295944268/Data.mdb.html<br /><br />Please Hep me with this...<br /> thanks...<br /><br /><br /><br />]]></description>
		<pubDate>Wed, 21 Oct 2009 08:46:29 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28234</guid>
	</item>
	<item>
		<title>How To Be A Mysql Dba?</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28207</link>
		<description><![CDATA[how to be a MySQL DBA from a beginner? and what's the prospective of this career in USA or Canada?<br />besides, I learned that Oracle is popular recently, whether it is used most often than MySQL nowadays? <br /><br />any experts who can guide me, very important to me!<br /><br />thank you all!]]></description>
		<pubDate>Tue, 20 Oct 2009 10:53:50 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28207</guid>
	</item>
	<item>
		<title>Select Last 10 Results In Asc Order</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28196</link>
		<description><![CDATA[I want to select the most recent 10 results from a table, but to fetch them in reverse order.  I am playing around with a chat app and so far it fetches the most recent 10 items with this line:<br /><br />$new = "SELECT * FROM &#96;buffer&#96; ORDER BY time_added DESC LIMIT 10";<br /><br />This returns the correct results, but when I echo them they are in the wrong order - most recent is at the top.  I want to have the most recent message display at the bottom, as is the norm for a chat room/IM window.  I am aware of array_reverse, but can't get it to work.  I store the mysqli array in a variable, reverse it and try to while through the array and my ajax call times out.  I would like to create a single query that selects in ascending order but uses as the start limit the total number of rows -10.  I tried LIMIT (COUNT(*)-10), 10 and a few other ways of putting it but got nowhere.]]></description>
		<pubDate>Mon, 19 Oct 2009 15:20:36 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28196</guid>
	</item>
	<item>
		<title>Getting Deeper... Displaying Records To Edit</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28186</link>
		<description><![CDATA[Ok, so I have a form to enter data into a db. But soon 2000 new records are going into this db and there is going to have be a way to search for, retrieve and edit records individually.<br /><br />I assume I'll use the SELECT FROM WHERE, but the tutorial explains it as WHERE is hard-coded into the request. The SELECT and FROM are given, of course.<br /><br />Baby steps.<br /><br />Can I use the same form used to create a new record in the db to display a record for editing? Or does it need to be a different form?<br /><br />This is the code from the tutorial. How do I make it so I can enter the WHERE and SUBMIT it to query the db and return the results in a form for editing?<br /><!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->&lt;?php<br />$con = mysql_connect("localhost","peter","abc123");<br />if (!$con)<br />  {<br />  die('Could not connect: ' . mysql_error());<br />  }<br /><br />mysql_select_db("my_db", $con);<br /><br />$result = mysql_query("SELECT * FROM Persons<br />WHERE FirstName='Peter'");<br /><br />while($row = mysql_fetch_array($result))<br />  {<br />  echo $row['FirstName'] . " " . $row['LastName'];<br />  echo "&lt;br /&gt;";<br />  }<br />?&gt;<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />Here's an example of the form I want to be able to edit the record with.<br /><br /><a href="http://bigsilkdesign.com/will/firm_profile.php" target="_blank">View the form</a><br /><br />It's the input form. So, what I'm looking to do is to be able to type in a unique identifier (username), click SUBMIT to find the record,  and have it populate the form fields for editing and then allow the user to UPDATE the record.]]></description>
		<pubDate>Mon, 19 Oct 2009 09:54:01 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28186</guid>
	</item>
	<item>
		<title>How To Fetch An Array Of Column Names From A Table</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28184</link>
		<description>Title says it all really.  If I had a table with unknown columns and I wanted to return a list of column names, how can I do it without selecting any particular row?  I know I could just select a record and foreach through them, extracting the keys, but is there a way without actually extracting any particular record?</description>
		<pubDate>Sun, 18 Oct 2009 19:57:56 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28184</guid>
	</item>
	<item>
		<title>My First Foray Into Mysql</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28181</link>
		<description><![CDATA[I set up a db in MySQL through cPanel. It's there. I see it.<br /><br />I'm trying to create a table in which to store data from an online form.<br /><br />I'm not quite sure how to create the table in the db. I believe I have the right code:<br /><!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->&lt;?php<br />$con = mysql_connect("localhost","***","***");<br />if (!$con)<br />  {<br />  die('Could not connect: ' . mysql_error());<br />  }<br /><br />// Create table<br />mysql_select_db("bigsilkd_attorneys", $con);<br />$sql = "CREATE TABLE attorneys<br />(<br />attoneyID int NOT NULL AUTO_INCREMENT, <br />PRIMARY KEY(attorneyID),<br />LawFirmName varchar(30),<br />MainOfficeAddress varchar(30),<br />MainOfficeCity varchar(30),<br />MainOfficeState varchar(2),<br />MainOfficeZip varchar(10),<br />MainOfficePhone varchar(30),<br />MainOfficeEmail varchar(30),<br />WebAddress varchar(30),<br />Overview varchar(30),<br />YearsofExperience int (3),<br />Languages varchar(30),<br />GeographiesServing varchar(30),<br />PracticeAreas varchar(30),<br />MainAttorneyName varchar(30),<br />MainAttorneyPhone varchar(30),<br />MainAttorneyEmail varchar(30),<br />)";<br /><br />// Execute query<br />mysql_query($sql,$con);<br /><br />mysql_close($con);<br />?&gt;<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />But when I fill out the form and hit the Submit button:<br /><!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->&lt;form action="insert.php" method="post"&gt;<br />  Law Firm Name: &lt;input type="text" size="90" name="LawFirmName"&gt;&lt;br&gt;<br />  'Tag Line': &lt;input type="text" size="95" name="p_subtitle"&gt;&lt;br&gt;<br />  Your Name: &lt;input type="text" size="97" name="p_name"&gt;&lt;br&gt;<br />  Office Street Address: &lt;input type="text" size="77" name="MainOfficeAddress"&gt;&lt;br&gt;<br />  Office City: &lt;input type="text" size="22" name="MainOfficeCity"&gt;<br />  Office State: &lt;select name="MainOfficeState" size="1"&gt;<!--QuoteEnd--></div><!--QuoteEEnd--><br />(There's more to the form, I'm just excluding it for the sake of cleanliness.)<br /><br />I get this:<br /><br />Error: Table 'bigsilkd_attorneys.attorneys' doesn't exist<br /><br />I assume that CREATE TABLE needs to be run once, but I'm not sure how to get it to run, or whether or not I was successful. It's apparent I wasn't.<br /><br />Here's insert.php:<br /><!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->&lt;?php<br />$con = mysql_connect("localhost","***","***");<br />if (!$con)<br />  {<br />  die('Could not connect: ' . mysql_error());<br />  }<br /><br />mysql_select_db("bigsilkd_attorneys", $con);<br /><br />$sql="INSERT INTO attorneys (LawFirmName, MainOfficeAddress, MainOfficeCity, MainOfficeState, MainOfficeZip, MainOfficePhone, MainOfficeEmail, WebAddress, Overview, YearsofExperience, Languages, GeographiesServing, PracticeAreas, MainAttorneyName, MainAttorneyPhone, MainAttorneyEmail)<br />VALUES<br />('$_POST[LawFirmName]','$_POST[MainOfficeAddress]','$_POST[MainOfficeCity]','$_POST[MainOfficeState]','$_POST[MainOfficeZip]','$_POST[MainOfficePhone]','$_POST[MainOfficeEmail]','$_POST[WebAddress]','$_POST[Overview]','$_POST[YearsofExperience]','$_POST[Languages]','$_POST[GeographiesServing]','$_POST[PracticeAreas]','$_POST[MainAttorneyName]','$_POST[MainAttorneyPhone]','$_POST[MainAttorneyEmail]')";<br /><br />if (!mysql_query($sql,$con))<br />  {<br />  die('Error: ' . mysql_error());<br />  }<br />echo "1 record added";<br /><br />mysql_close($con)<br />?&gt;<!--QuoteEnd--></div><!--QuoteEEnd--><br />]]></description>
		<pubDate>Sun, 18 Oct 2009 15:12:04 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28181</guid>
	</item>
	<item>
		<title>Limiting Queries</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28171</link>
		<description><![CDATA[I have a sql table called menu. In the table I have menu links with parents and childs. <br />Example:<br />-&gt; parent #1<br />--&gt; child #1<br />--&gt; child #2<br />-&gt; parent #2<br />--&gt; child #1<br /><!--QuoteBegin-Menu Format+--><div class='quotetop'>QUOTE (Menu Format)</div><div class='quotemain'><!--QuoteEBegin-->id<br />link<br />name<br />power // 1 if parent and 2 if child<br />under //if child<br />order<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />But I have too many queries sent to the database and I was wondering how can I limit the queries.<br />Part of the code.<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// already connected to sql host and database<br /><br />$query = mysql_query&#40;&#34;SELECT * FROM menu where power = 1 ORDER BY order&#34;&#41;;<br />while&#40;$row =&nbsp;&nbsp;mysql_fetch_array&#40;$query&#41;&#41;<br />{<br />echo &#34;&#60;a href='{$row&#91;'link'&#93;}'&#62;{$row&#91;'name'&#93;}&#60;/a&#62;&#60;br&#62;/n&#34;;<br />$query2 = mysql_query&#40;&#34;SELECT * FROM menu where under = {$row&#91;'id'&#93;} ORDER BY order&#34;&#41;;<br />$query3 = mysql_num_rows&#40;$query2&#41;;<br />if&#40;$query3 &#62;= 1&#41;<br /> {<br /> while&#40;$row2 = mysql_fetch_array&#40;$query2&#41;&#41; <br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;echo &#34;-&#62; &#60;a href='{$row2&#91;'link'&#93;}'&#62;{$row2&#91;'name'&#93;}&#60;/a&#62;&#34;;<br />&nbsp;&nbsp;}<br /> }<br />}<!--c2--></div><!--ec2-->]]></description>
		<pubDate>Sun, 18 Oct 2009 01:51:08 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28171</guid>
	</item>
	<item>
		<title>Ordering Results</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28156</link>
		<description><![CDATA[Hi guys,<br /><br />First time poster.<br /><br />I'm a little,... well very rusty, with my SQL. Figured you experts out there would have an idea as to how to solve my problem here.<br /><br /><br />Little background on the database:<br />-It's a historical database with events and people from time; each record has a name, description, a start year, an end year, startYear suffix*, endYear suffix*<br />*Suffix = BC or AD or MYA<br /><br />Corresponding with the above information, here is an example record:<br /><br />Example#1:<br /><br />John Doe | Famous Musician born in the 19th century | 1839 | 1910 | AD | AD<br /><br /><br />Example2:<br /><br />Roman Period | The Roman Empire | 63 | 476 | BC | AD<br /><br />Example 3:<br /><br />Stone Age | The Human Era | 5 | 2500 | MYA | BC<br /><br /><br /><br />The problem:<br />Now, this is simple enough, but I have BC and MYA dates as well. So there could technically be an 1839 AD as well as an 1839 BC date or even an 1839 MYA year.<br /><br />Figuring out which record to return (the AD, BC, or MYA) is not a problem by itself, but when I have to return a set of records say from the year 2000MYA to 2000AD, you can see that things might not be so clean cut if I simply order the records via ORDER BY ASC/DESC in relation to the starting year of the record.<br /><br />I'm hoping there is a way to do "two" or "three" selects and combine the results where if I searched from 2000MYA to 2000AD, the first part would return all records which years are from a MYA era, in this case 2000MYA, ordered in an ascending fashion all the way to 0.<br />Then, combine the results with another search that selects all records greater than the year 0 (BC dates in this case) ordered in an descending fashion then finally list the AD dates in an ascending manner.<br /><br />You'd get records that show years like such:<br />2000 MYA, 1500 MYA, 500 MYA, 30 MYA, 5 BC, 350 BC, 2000 BC, 1500 BC, 10 BC, 15AD, 1500 AD, 1993 AD, 2009 AD<br /><br />So in SQL terms, the statement would look like follows (of course this statement does NOT work, but you get the idea of what I'm trying to do):<br /><br /><br />select * from tablename WHERE startYearSuffix = 'MYA' ORDER BY event_Start DESC<br />UNION<br />select * from tablename WHERE startYearSuffix = 'BC' ORDER BY event_Start DESC<br />UNION<br />select * from tablename WHERE startYearSuffix = 'AD' ORDER BY event_Start ASC;<br /><br /><br /><br />Thanks a lot for the help.<br /><br />]]></description>
		<pubDate>Fri, 16 Oct 2009 15:38:49 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28156</guid>
	</item>
	<item>
		<title>Question About Multiple Databases</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28152</link>
		<description><![CDATA[Rather new to SQL and before I go barking completely up the wrong tree in tracking down a solution, I want to find out if what I am attempting is even possible in MS SQL 2005 or 2008.<br /><br />Is there a way to have fields in one database, somehow mapped or linked to another for simultaneous, or nearly so, updating?<br /><br />Example<br /><br />Db1.table1<br />RecID<br />Name<br />Age<br /><br />Db1.table2<br />RecID1<br />RecID<br />Eyecolor<br />Haircolor<br /><br />Db1.table3<br />RecID2<br />RecID<br />Weight<br />Height<br /><br /><br /><br /><br />Db2.table1<br /><br />RecID3<br />RecID<br />Name<br />Age<br />Eyecolor<br />Haircolor<br />Weight<br />Height<br /><br /><br />Thanks for any info on this.]]></description>
		<pubDate>Fri, 16 Oct 2009 10:50:46 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28152</guid>
	</item>
	<item>
		<title>Convenient One-shot Way To Select Value Irrespective Of Case</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28135</link>
		<description><![CDATA[I want to allow users to register with their username/email address in any combination of upper and lower case characters they like, but to check at registration, login and account management instances that no e-mail address with the same username/email address exists irrespective of case.  I am aware that I can use LOWER() in mysql queries, but if I tried, for example:<br /><br />"SELECT id FROM aromaMaster WHERE email = '".strtolower($email)."'";<br /><br />that would only work if I did strtolower on insertion, right?  Can I make the WHERE email clause case insensitive?]]></description>
		<pubDate>Thu, 15 Oct 2009 10:34:53 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28135</guid>
	</item>
	<item>
		<title>Sql Join With Search Option</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28088</link>
		<description><![CDATA[Greetings<br /><br />I have two tables in one msaccess database. It is a one-to-many relationship.<br />Table A is the "Master" table, while table B will hold records relating to a record in table A.<br /><br />I am working in VB6.<br /><br />I have a form that displays all records from table B, as well as able to navigate all the records.<br />I also have a search option for two specific fields in table B. These options as chosen by the use of radio buttons.<br /><br />My Search code is as follows:<br /><br />    RS.Close<br />    RS.ActiveConnection = CN<br />    If optDebtor.Value = True Then<br />    RS.Source = "Select * from tableB full join tableA to tableB.refno=tableA.refno where tableB.name like '%" & txtSearch.Text & "%'order by name"<br />    ElseIf optCompany.Value = True Then<br />    RS.Source = "Select * from tableB full join tableA to tableB.refno=tableA.refno where tableB.co like'%" & txtSearch.Text & "%'order by co"<br />    End If<br /><br />    RS.CursorType = adOpenStatic<br />    RS.LockType = adLockOptimistic<br />    RS.Open<br /><br />error message<br /><br />Method 'Open' of object '_Recordset' failed<br /><br />The object of the above sql queries is to display all the information from tableB and only the fields (tableA.name and table A.co) in a label. this is to see which "name and co" belong to the information displayed from tableB.<br /><br />I have tried Inner join as well as Outer join as well as Right join as well as Left join, but without any success.<br /><br />I would sincerely appreciate any assistance.<br /><br />Thanking You in Advance<br /><br />Brice]]></description>
		<pubDate>Mon, 12 Oct 2009 15:38:44 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28088</guid>
	</item>
	<item>
		<title>Quick Sql Problem</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28087</link>
		<description><![CDATA[Hi I'm just learning SQL,<br /><br />can someone tell me what I'm doing wrong on this line?:<br /><br />"SELECT ID, Name FROM cms_sci ORDER BY Name WHERE ID&lt;50"<br /><br /><br />Thanks!]]></description>
		<pubDate>Mon, 12 Oct 2009 15:17:27 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28087</guid>
	</item>
	<item>
		<title>Query Problem</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28052</link>
		<description><![CDATA[&lt;b&gt;Warning&lt;/b&gt;:  odbc_exec() [&lt;a href='function.odbc-exec'&gt;function.odbc-exec&lt;/a&gt;]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1., SQL state 07001 in SQLExecDirect in &lt;b&gt;C:&#092;Inetpub&#092;wwwroot&#092;php_new&#092;main.php&lt;/b&gt; on line &lt;b&gt;13&lt;/b&gt;&lt;br /&gt;<br /><br />i had made this query and that error occured.<br />$rs = odbc_exec($con,"SELECT * FROM point WHERE Name='" . $_COOKIE['username'] . "'");<br />where point is the name of table which consists of three columns point(number),reason(text),name(text)<br />$_COOKIE['username'] is text..]]></description>
		<pubDate>Sat, 10 Oct 2009 16:28:14 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28052</guid>
	</item>
	<item>
		<title>Order By Not Working Properly</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28036</link>
		<description><![CDATA[i have 2 columns. one is name and other is runs.<br />i used this statement<br />SELECT Name,Runs FROM Data ORDER BY Runs<br />the the first two row were correctly ordered but after that all other results were ordered by name..<br />i don't know what is the error. Is there any alternative for this...]]></description>
		<pubDate>Fri, 09 Oct 2009 12:19:39 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28036</guid>
	</item>
	<item>
		<title>From Join Muilt-tabels Different Joins</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28020</link>
		<description><![CDATA[I'm have this problem were I need to a total line for ever Doctor even if there is no invoices to sum up.  I'm sure it all connected to the need to connect more then 2 table on the from ... join statement.  Ignore the null columns, they are to match up with the detail list, that are unneeded for the summary rows.  when I run this query, I should receive 100 rows, but I'm only receiving 81 and 19 that are missing as zero sales and zero units.  It make making a summary page a pure pain because you have to manual match up doctor for each category grouping.  <img src="http://w3schools.invisionzone.com/style_emoticons/default/mad.gif" style="vertical-align:middle" emoid=":angry:" border="0" alt="mad.gif" />  If all the rows were there, it would be a 15 min job at best.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->select '', Invoices.DoctorNo, rtrim&#40;Doctor.Name&#41; as Doctor_Name, '', '',<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '', '', '',<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '', '',<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '', '', '',<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '', '', '', '',<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sum&#40;Invoices_Products.ProdAmount&#41;, sum&#40;Invoices_Products.ProdQty&#41;<br />&nbsp;&nbsp;from &#40;&#40;&#40;&#40;Doctor&nbsp;&nbsp; left join Invoices on Invoices.Lab = Doctor.Lab<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and Invoices.DoctorNo = Doctor.Doctor&#41;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inner join Invoices_Products on Invoices_Products.Lab = Invoices.Lab<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and Invoices_Products.CaseNo = Invoices.CaseNo<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and Invoices_Products.Invoice = Invoices.Invoice&#41;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inner join Products&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;on Products.Lab = Invoices_Products.Lab<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and Products.Product = Invoices_Products.Product&#41;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inner join Category&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;on Category.Lab = Products.Lab<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and Category.Category = Products.Category&#41;<br />&nbsp;&nbsp;where Doctor.Lab = 1 and &#40; Doctor.SalesSource = '26' or &#40; Doctor.SalesSource = '27' and Invoices.Shipped &#60; '2008-03-31' &#41; &#41; and Invoices.Shipped &#62; '2008-12-31'<br />&nbsp;&nbsp;&nbsp;&nbsp;and&nbsp;&nbsp;&nbsp;&nbsp;&#40; Category.Category = 'DA' or Category.Category = 'HA' or Category.Category = 'GA' or Category.Category = 'WA' &#41;<br />&nbsp;&nbsp;group by Invoices.DoctorNo, Doctor.Name<!--c2--></div><!--ec2-->]]></description>
		<pubDate>Thu, 08 Oct 2009 13:17:44 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28020</guid>
	</item>
	<item>
		<title>Complicated Query</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=28011</link>
		<description><![CDATA[Hi all, I'm working on a query to get a sum of entries of certain item in a determined period of time, for instance, how many pens were received in October and I'm using this code:<br />Data1.RecordSource = "select sum(quantity) as totalentries from mientries where itemid = " & Text1.Text & " and date between #" & DTPicker1.Value & "# and #" & DTPicker2.Value & "# " the thing is that is not working as I wish, because I get the total of entries, instead of the total for the period of time. Any suggestion will be greatly appreciated, Coldgeorge.<br />]]></description>
		<pubDate>Thu, 08 Oct 2009 09:32:55 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=28011</guid>
	</item>
	<item>
		<title>Sql Query Or Stored Procedure</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27999</link>
		<description><![CDATA[Hi,<br /><br />I need some help to bulid stored procedure or some query that can read from table column some text (where separator is example ",") and put it some other table rows.<br />For example:<br />create table #test(line varchar(100))<br />insert into #test(line) <br />values ('test1, test2, test3')<br /><br />now is result like this:<br />   line<br />1 test1, test2, test3<br /><br />what i need is that word will be in different rows:<br />   line<br />1 test1<br />2 test2<br />3 test3<br />]]></description>
		<pubDate>Thu, 08 Oct 2009 02:07:23 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27999</guid>
	</item>
	<item>
		<title><![CDATA[Mysql -&gt; Guidelines ?]]></title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27989</link>
		<description><![CDATA[I'm planing for a new big project I was wondering how I should plan my database.<br /><br />I know it's not like one great awnser to it but what should I think about, so I don't get 10 tables where I need to use 2 tables?]]></description>
		<pubDate>Wed, 07 Oct 2009 07:27:32 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27989</guid>
	</item>
	<item>
		<title>Creating A Trigger For Dvd Transaction Scenarios</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27971</link>
		<description><![CDATA[Hi Guys,<br /><br />I am having trouble creating a trigger for this scenario...<br /><br />In the DVD transaction scenarios, every time a new TransactionDisk record is inserted the Status of the Disk has to be updated to either out or in depending on whether the disk is being rented out or returned. How do i write the trigger for the TransactionDisk table to execute the update of the corresponding Disk Status?  <img src="http://w3schools.invisionzone.com/style_emoticons/default/Bucktooth.gif" style="vertical-align:middle" emoid=":Bucktooth:" border="0" alt="Bucktooth.gif" />]]></description>
		<pubDate>Mon, 05 Oct 2009 22:00:03 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27971</guid>
	</item>
	<item>
		<title>Out Of Memory (needed 8164 Bytes)</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27953</link>
		<description><![CDATA[hello all<br /><br />i have a problem like so <br />i have a script writen in c++ that does MANY select queries <br />82,301,184 is the number of SELECT queries it needs to make <br />and a much smaller number of INSERT queries about 9,000<br />at about 100,000 SELECT queries (and 10 INSERT) <br />i get the next error massage - "Out of memory (needed 8164 bytes)"<br /><br />can any one shed some light on this memory issue ?<br />what should i check for ?<br /><br />thank you<br />Tal]]></description>
		<pubDate>Sun, 04 Oct 2009 14:32:51 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27953</guid>
	</item>
	<item>
		<title>Mysql Insert Or Update Query Help</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27934</link>
		<description><![CDATA[I have a table, sessionBasket, that holds a list of the items in the shopping baskets of visitors to my site.  It looks like:<br /><br />id INT NOT NULL AUTO_INCREMENT PRIMARY KEY<br />usersessid VARCHAR<br />date_added DATETIME<br />product_id INT<br />qty INT<br /><br />My add to basket script first checks for the presence of an item with the current product_id in this table associated with the usersessid and if it finds one, it updates the qty.  If not, a separate query inserts a new row with the relevant information.  <br /><br />I have since discovered there is a condition ON DUPLICATE KEY UPDATE but I'm not sure what I need to change to cause this to function correctly.  I would need two keys here - product_id and usersessid, and if there is a row with both of these matching the ones I'm trying to insert, the update condition is made.  I am sure there is a better way to do it than I already do.  In addition, I check the product_id is valid in case it is spoofed somehow, so overall I make two queries just to check stuff, and then another to do the update/insert.<br /><br />Here are the separate queries:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->//do select query to verify item id<br />$check_sql = &#34;SELECT * FROM aromaProducts1 WHERE id='&#34;.intval&#40;$_GET&#91;&#34;productid&#34;&#93;&#41;.&#34;'&#34;;<br />$check_res = mysqli_query&#40;$mysqli, $check_sql&#41; or&nbsp;&nbsp;error_log&#40;mysqli_error&#40;$mysqli&#41;.&#34;&#092;r&#092;n&#34;&#41;;<br /><br />&nbsp;&nbsp;//do select query to check for item id already in basket<br />&nbsp;&nbsp;$duplicate_sql = &#34;SELECT qty FROM sessionBasket WHERE product_id='&#34;.intval&#40;$_GET&#91;&#34;productid&#34;&#93;&#41;.&#34;' AND usersessid='&#34;.session_id&#40;&#41;.&#34;'&#34;;<br />&nbsp;&nbsp;$duplicate_res = mysqli_query&#40;$mysqli, $duplicate_sql&#41; or&nbsp;&nbsp;error_log&#40;mysqli_error&#40;$mysqli&#41;.&#34;&#092;r&#092;n&#34;&#41;;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;//item in basket - add another<br />&nbsp;&nbsp;&nbsp;&nbsp;$add_sql = &#34;UPDATE sessionBasket SET qty=qty+&#34;.intval&#40;$_GET&#91;&#34;qty&#34;&#93;&#41;.&#34;&nbsp;&nbsp;WHERE usersessid='&#34;.session_id&#40;&#41;.&#34;'AND product_id='&#34;.intval&#40;$_GET&#91;&#34;productid&#34;&#93;&#41;.&#34;'&#34;;<br />&nbsp;&nbsp;&nbsp;&nbsp;$add_res = mysqli_query&#40;$mysqli, $add_sql&#41; or&nbsp;&nbsp;error_log&#40;mysqli_error&#40;$mysqli&#41;.&#34;&#092;r&#092;n&#34;&#41;;<br /><br />&nbsp;&nbsp;//insert query<br />&nbsp;&nbsp;$insert_sql = &#34;INSERT INTO &#34;.$table.&#34; &#40;userid, usersessid, date_added, product_id, qty, notes&#41; VALUES &#40;<br />&nbsp;&nbsp;'&#34;.$userid.&#34;',<br />&nbsp;&nbsp;'&#34;.session_id&#40;&#41;.&#34;',<br />&nbsp;&nbsp;now&#40;&#41;,<br />&nbsp;&nbsp;'&#34;.htmlspecialchars&#40;$productid&#41;.&#34;',<br />&nbsp;&nbsp;'&#34;.intval&#40;$_GET&#91;&#34;qty&#34;&#93;&#41;.&#34;',<br />&nbsp;&nbsp;'&#34;.htmlspecialchars&#40;$notes&#41;.&#34;'&#41;&#34;;<br />&nbsp;&nbsp;$insert_res = mysqli_query&#40;$mysqli, $insert_sql&#41; or&nbsp;&nbsp;error_log&#40;mysqli_error&#40;$mysqli&#41;.&#34;&#092;r&#092;n&#34;&#41;;<!--c2--></div><!--ec2--><br /><br />Please no replies about SQL injection - my sanitizing is much more thorough than these snippets let on!<br /><br />Any help shrinking these down would be fantastic - I'm a noob at database queries (though I just got The Manga Guide To Databases, so I'm well on my way...uh...or not).]]></description>
		<pubDate>Fri, 02 Oct 2009 16:05:37 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27934</guid>
	</item>
	<item>
		<title>Unable To Test For When A Table Was Last Updated</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27927</link>
		<description><![CDATA[While trying to determine when a specific table was last updated, an error message appeared (using SQL Server Management Studio).<br /><br />Error: <br />Msg 208, Level 16, State 1, Line 1<br />Invalid object name 'sys.dm_db_index_usage_stats'.<br /><br />See code below:<br /><div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>SELECT OBJECT_NAME(OBJECT_ID) AS DatabaseName, last_user_update,*<br />FROM sys.dm_db_index_usage_stats<br />WHERE database_id = DB_ID('MasteryNet')<br />AND OBJECT_ID=OBJECT_ID('LAST_RECORDS'</div><br /><br />Not sure what else to try to get the code to run without errors....any suggestions would be a great help!<br /><br />Thanks!<br /><br /><br /><br />]]></description>
		<pubDate>Fri, 02 Oct 2009 10:14:53 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27927</guid>
	</item>
	<item>
		<title>Mysql Fetch Array Unique</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27918</link>
		<description><![CDATA[I want to dynamically populate a list of product categories, each of which will link to a page with all that category's products on it.  Each product in my database has a main category associated with it, so all I need to do is to fetch the category row and for each entry echo an appropriate link (and, for the product category nav menu, an appropriate li).  Obviously there will be more than one product per category, so I want a unique array.  Is there one single query for this, or should I just fetch the array normally and then do:<br /><br />$array = array_unique($mysql_fetch_array);<br /><br />?<br /><br />My queries so far have all been extremely basic, and I am trying to learn the little nuances that save lines and save time.  I already have a complicated document for inserting/updating my shopping basket and THEN learned about ON DUPLICATE KEY UPDATE - what a time saver that would've been.]]></description>
		<pubDate>Thu, 01 Oct 2009 17:33:01 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27918</guid>
	</item>
	<item>
		<title>Select Records Based On The Largest Value Of A Field By Two Join</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27883</link>
		<description><![CDATA[<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->edit_band &nbsp;&nbsp;&nbsp;&nbsp;edit_user &nbsp;&nbsp;&nbsp;&nbsp;edit_time &nbsp;&nbsp;&nbsp;&nbsp;edit_block &nbsp;&nbsp;&nbsp;&nbsp;edit_reason<br />1 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;1248635164 &nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Prova Motivo<br />1 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;1248635285 &nbsp;&nbsp;&nbsp;&nbsp;2 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Prova Motivo 2<br />2 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;1250939034 &nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Prova Motivo 3<br />1 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;1250978390 &nbsp;&nbsp;&nbsp;&nbsp;4<br />1 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;1250984273 &nbsp;&nbsp;&nbsp;&nbsp;4<br />1 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;1250984277 &nbsp;&nbsp;&nbsp;&nbsp;4<br />1 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;1250984314 &nbsp;&nbsp;&nbsp;&nbsp;4<br />1 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;1250984317 &nbsp;&nbsp;&nbsp;&nbsp;4<br />1 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;1250984351 &nbsp;&nbsp;&nbsp;&nbsp;4<br />1 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;1250984361 &nbsp;&nbsp;&nbsp;&nbsp;4<br />1 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;1250984533 &nbsp;&nbsp;&nbsp;&nbsp;4<!--c2--></div><!--ec2--><br />As you can see the first field has many duplicate values. Now, I have to take the row for each unique ID in edit_band which has the edit_time greater.<br />The problem is that I take the data, but I melee them all.<br /><br />The query I use now is this:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->SELECT band.band_id, band.band_name, edit.*, user.username, COUNT&#40;edit.edit_band&#41; AS total<br />FROM ip_bands AS band<br />RIGHT JOIN ip_bands_edits AS edit ON edit.edit_band = band.band_id<br />LEFT JOIN ip_users AS user ON edit.edit_user = user.user_id<br />GROUP BY edit.edit_band<br />ORDER BY edit.edit_time DESC LIMIT 0, 10<!--c2--></div><!--ec2--><br /><br />I wrong section, sorry! You could move it to SQL?]]></description>
		<pubDate>Wed, 30 Sep 2009 09:32:56 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27883</guid>
	</item>
	<item>
		<title><![CDATA[Sql 2005 Insert & Update Triggers]]></title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27866</link>
		<description><![CDATA[I've used the code below for a MySQL database and it worked fine. However, now I am using an SQL 2005 database and I am trying to replicate the code below but I am having trouble converting the triggers. <br /><br />I understand that I can't use TIMESTAMP and instead I have to go with DATETIME data type but how do you write the same trigger for SQL 2005 database so it functions similar to the way it did in MySQL database.<br /><br />Thanks in advance.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->CREATE TABLE EVENT &#40;<br />&nbsp;&nbsp; EventID INT UNSIGNED NOT NULL AUTO_INCREMENT,<br />&nbsp;&nbsp; DateFrom DATE NOT NULL,<br />&nbsp;&nbsp; DateTo DATE NOT NULL,<br />&nbsp;&nbsp; EventTitle VARCHAR&#40;50&#41; NOT NULL,<br />&nbsp;&nbsp; Event TEXT NOT NULL,<br />&nbsp;&nbsp; Created TIMESTAMP DEFAULT '0000-00-00 00&#58;00&#58;00',<br />&nbsp;&nbsp; Updated TIMESTAMP DEFAULT '0000-00-00 00&#58;00&#58;00',<br />&nbsp;&nbsp; PRIMARY KEY&#40;EventID&#41;<br />&#41;;<br /><br />CREATE TRIGGER EVENT_TIME_CREATED<br />&nbsp;&nbsp; BEFORE INSERT ON EVENT<br />&nbsp;&nbsp; FOR EACH ROW SET NEW.Created = NOW&#40;&#41;, <br />&nbsp;&nbsp; NEW.Updated = '0000-00-00 00&#58;00&#58;00';<br /><br />CREATE TRIGGER EVENT_TIME_UPDATED <br />&nbsp;&nbsp; BEFORE UPDATE ON EVENT<br />&nbsp;&nbsp; FOR EACH ROW SET NEW.Updated = NOW&#40;&#41;, <br />&nbsp;&nbsp; NEW.Created = OLD.Created;<!--c2--></div><!--ec2-->]]></description>
		<pubDate>Tue, 29 Sep 2009 14:19:50 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27866</guid>
	</item>
	<item>
		<title>Mysql Config File Not Accessible</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27843</link>
		<description><![CDATA[Hi<br /><br />i have a database running on HostMonster Server... the problem is that they do not allow customers to change settings.<br /><br />they say "The my.cnf  file for the server is not accessible" .. <br /><br /><br />basically wat i need to do is to change the min number of characters in search .. ft_min_word_len = 4 is the default, now since i cant do anything about that , how can i solve the problem in other ways... ?<br /><br />]]></description>
		<pubDate>Mon, 28 Sep 2009 09:51:04 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27843</guid>
	</item>
	<item>
		<title>Sorting Search Results By Relevance</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27836</link>
		<description><![CDATA[Hello all,<br /><br />i have a search function that allows users to search by keywords.. the results i get is okay but i need to sort it based on relevance .. meaning if a user search for "red fresh apple" he/she gets the results of all entries having those words but sort it starting from the entries having all 3 .. then at least 2 matched .. and finally entries with at least 1 word match.<br /><br />here is the sql query im using:<br /><br />mysql_query("SELECT id FROM autos WHERE MATCH (ad_title, ad_desc, make, model) AGAINST ('$search' IN BOOLEAN MODE)");<br /><br /><br /><br /><br />please help.]]></description>
		<pubDate>Mon, 28 Sep 2009 04:40:35 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27836</guid>
	</item>
	<item>
		<title>Wamp/phpmyadmin Export</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27823</link>
		<description><![CDATA[Hi. Does anyone know how to export a database from Wamp using phpMyAdmin?<br />When I have tried to do this, it creates an SQL file containing the tables and data. <br />Then when I try to import I get the error message - <br />No Database Selected.<br />So I have to create a database and then import the tables.<br />Is there a way to create one file that includes the database itself?<br /><br />Thanks for any help.<br />Ali]]></description>
		<pubDate>Sun, 27 Sep 2009 13:15:40 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27823</guid>
	</item>
	<item>
		<title>Foreign Key</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27792</link>
		<description><![CDATA[Hello, I'm trying to set up a foreign key on two InnoBD tables through PHPMyAdmin. I don't see any options to allow this, and the online help documents are very confusing. I was hoping to get help with this.<br /><br />Here's the deal, I have two tables, one named <b>book</b> and the other <b>user</b>. In <b>book</b> I have an <i>id</i> (for the book, and also is a primary key) and a <i>UserId</i> (for the user). I want to link the <i>UserId</i> in <b>book</b> to the <i>UserId</i> in the <b>user</b> table. This is done with a foreign key, but I don't see the option to allow this.<br /><br />Here are some images to get a better idea with what I'm working with:<br /><a href="http://i7.photobucket.com/albums/y268/HYPNOTOAD000/PHPMyAdmin_2.png" target="_blank">table: book</a><br /><a href="http://i7.photobucket.com/albums/y268/HYPNOTOAD000/PHPMyAdmin_3.png" target="_blank">table: user</a><br /><a href="http://i7.photobucket.com/albums/y268/HYPNOTOAD000/PHPMyAdmin_1.png" target="_blank">both tables</a><br /><br />I know this can be done, but I'm not understanding it. Can someone explain how to do this?]]></description>
		<pubDate>Fri, 25 Sep 2009 02:17:18 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27792</guid>
	</item>
	<item>
		<title>Basic Sql Question</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27744</link>
		<description><![CDATA[I'm new to SQL and I'm stuck on a problem I'm trying to do in Oracle. I have two tables CUSTOMERS and ORDERS as follows:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->CUSTOMERS<br />+--------+---------+<br />|&nbsp;&nbsp; cid&nbsp;&nbsp;|&nbsp;&nbsp; cname |&nbsp;&nbsp;&nbsp;&nbsp; <br />+--------+---------+<br />|&nbsp;&nbsp; c001&nbsp;&nbsp;| TipTop | <br />|&nbsp;&nbsp; c002&nbsp;&nbsp;| Basics | <br />|&nbsp;&nbsp; c003&nbsp;&nbsp;| Allied |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />|&nbsp;&nbsp; c004&nbsp;&nbsp;| ACME&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />|&nbsp;&nbsp; c006&nbsp;&nbsp;| ACME&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />+--------+---------+<br /> <br /> <br />ORDERS<br />+-------+------+-----+-----+<br />|ordnum | cid&nbsp;&nbsp;| aid | pid | <br />+-------+------+-----+-----|<br />|&nbsp;&nbsp; 1011| c001 | a01 | p01 |<br />|&nbsp;&nbsp; 1012| c001 | a01 | p01 |<br />|&nbsp;&nbsp; 1019| c001 | a02 | p02 |<br />|&nbsp;&nbsp; 1017| c001 | a06 | p03 |<br />|&nbsp;&nbsp; 1021| c004 | a06 | p01 |<br />|&nbsp;&nbsp; 1016| c006 | a01 | p01 |<br />|&nbsp;&nbsp; 1024| c006 | a06 | p01 |<br />+-------+------+-----+-----+<!--c2--></div><!--ec2--><br /><br />I'm trying to figure out an SQL command that can list the <i>cid</i> of customers who are linked to the <i>pid</i> values 'p01' AND 'p02'. So for example, 'c001' should come up since it is linked to both 'p01' and 'p02'. I tried this:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->SQL&#62; SELECT customers.cid&nbsp;&nbsp;<br />FROM customers <br />JOIN orders <br />ON customers.cid = orders.cid <br />WHERE&nbsp;&nbsp;pid='p01' AND pid='p02';<!--c2--></div><!--ec2--><br /><br />...before I realized that the logic behind that statement doesn't make sense. I've been racking my brain for a couple of hours now trying to figure it out. It's frustrating because I feel like the solution is simple but I'm just missing it.<br /><br />I would greatly appreciate any help.]]></description>
		<pubDate>Tue, 22 Sep 2009 19:54:16 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27744</guid>
	</item>
	<item>
		<title>Keeping .00 On Data.</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27717</link>
		<description><![CDATA[I have a field set to the data type FLOAT so I can have decimals in it. When I put something with .00 on the end (6.00, for example), it automatically cuts off the .00. I understand why it does this, but I was wondering if there's a way to make it not do that.]]></description>
		<pubDate>Mon, 21 Sep 2009 14:01:53 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27717</guid>
	</item>
	<item>
		<title>Browser Specific Server Side Scripting</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27711</link>
		<description><![CDATA[I'm having the strangest problem.  I have a script that lets you change the quantity of an item in your basket.  If you set the new quantity from a select element to anything bar one, the script updates the sessionBasket table with the new quantity.  If you set it to 0, it deletes the row.  This works fine.  Except on IE browsers (IE7, anyway), where it refuses to update or delete.  It is mind boggling.  Does IE7 manage more than one session id or what?  I use the session id as the ident for deleting or updating the table.  Has anyone else ever had a problem like this?]]></description>
		<pubDate>Mon, 21 Sep 2009 10:58:30 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27711</guid>
	</item>
	<item>
		<title>Cron Database Backup</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27704</link>
		<description><![CDATA[How do I use cron to back up the full database every 24 hours with partial backups done every 30 minutes? I then want the backup to either be added to me or be uploaded to a folder on the ftp server.<br /><br />Thanks]]></description>
		<pubDate>Mon, 21 Sep 2009 05:58:01 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27704</guid>
	</item>
	<item>
		<title>Selecting Top N Records For Each Country.</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27703</link>
		<description><![CDATA[Hey guys, it's been awhile since I've touched SQL, so I'm a little rusty. I have a table of over 50,000 cities, the table contains a fields for the Country, City Name, and Population. My goal is to create a query that will select each countries 15 most populated cities and list them in order. It seems like it should be simple enough, but for whatever reason I can't figure out what to do. It was simple to make a query to sort the table of cities by country, and than by population. But I don't want oor need all 50,000 fields listed, I would like to get the number of returned fields down to about 2000-4000.<br /><br /><div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>SELECT *<br />FROM Cities<br />ORDER BY Country, Population DESC;</div><br /><br />Any guidance on where to look for a solution would be very helpful!]]></description>
		<pubDate>Mon, 21 Sep 2009 04:52:03 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27703</guid>
	</item>
	<item>
		<title>Creating A Link From Search Results</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27693</link>
		<description><![CDATA[This has been one million of times on other sites, but I still can't figure out how to do this. I want a search result that shows up as a link, not just plain text. I thought it came from the echo""; function, but I was wrong. Is there anyway to do this? Thanks!]]></description>
		<pubDate>Sun, 20 Sep 2009 00:27:48 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27693</guid>
	</item>
	<item>
		<title>Update The Result Of A Query From A Number To A Text</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27680</link>
		<description><![CDATA[Hey,<br /><br />I'm facing troubles with a small query and am searching for advise:<br /><br />My query is looking like this:<br />select COUNT(product) as Y_Numbers<br />from &lt;Name-of-my-Table&gt;<br />where		FILTER ='0' AND (product LIKE 'A%')<br /><br /><br />the result of that query is looking like<br /><br /><br />_____|Y_Numbers<br />Row 1| 0<br /><br /><br /><br />If the result is 0, I want the result to be updated to "This filter is working properly".<br />If it is not 0, i want rhe result to be "Filter not working"<br /><br /><br />As you probably see, I'm totaly novice in sql...<br /><br />Thnx for help]]></description>
		<pubDate>Fri, 18 Sep 2009 10:15:07 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27680</guid>
	</item>
	<item>
		<title>Group Problem</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27661</link>
		<description><![CDATA[SELECT<br />  schedules.scheduletitle, MAX(reservations.end_date) AS end_date, MAX(reservations.start_date) AS start_date, resources.name, reservations.summary, reservations.machid<br />FROM<br />  cwlab.schedules LEFT OUTER JOIN cwlab.resources ON schedules.scheduleid = resources.scheduleid LEFT OUTER JOIN cwlab.reservations ON resources.machid = reservations.machid<br />WHERE<br />  schedules.scheduleid = 'cwe0000003640000' AND (reservations.end_date IS NOT NULL OR<br />  reservations.end_date IS NULL)<br />GROUP BY<br />  resources.name<br />ORDER BY<br />  resources.name<br /><br />================================================================<br />I try to get latest end date and Null end date. And print one resources.name per group.<br />Problem is every thing going find until to summary. The script only picks up the first summary in the group, is not match to the latest end date?<br />What I can do to fix this problem?  <br />]]></description>
		<pubDate>Wed, 16 Sep 2009 20:07:06 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27661</guid>
	</item>
	<item>
		<title>Search Among Several Sql Databases</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27647</link>
		<description><![CDATA[I am looking for a script or query that will allow for a common keyword search across several databases and return one consolidated recordset.  Has anyone ever done something similar, do you have any ideas on how to create the necessary coding?<br /><br />The only solution I can think of atm is to create a separate database that has a single table to hold the query results from each database query request, but I am hoping there is a more seksi, i.e. streamlined approach.]]></description>
		<pubDate>Tue, 15 Sep 2009 17:44:00 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27647</guid>
	</item>
	<item>
		<title>Port 80 Blocked</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27625</link>
		<description><![CDATA[hello sir <br />recently i installed wamp server . it worked fine for a week and then it stoped .<br />it was gettin timed out.i checked with port 80 it was fine httpd was runnning .<br />but wen browser did not respond until now . please help as soon as possible.and apache is gettin stopped wen i try to run local host from browser.]]></description>
		<pubDate>Tue, 15 Sep 2009 02:35:56 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27625</guid>
	</item>
	<item>
		<title>Get The Latest Date And Summery</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27620</link>
		<description><![CDATA[<b>name    |   start date       |       end date       |          summary</b><br />-------------------------------------------------------------------------------------------<br />danny        |   03/1/2009      |     30/1/2009      |       danny's message a<br />danny        |   03/2/2009      |     30/2/2009      |       danny's message b<br />danny        |   03/3/2009      |     30/3/2009      |       danny's message c<br />danny        |   03/4/2009      |     30/4/2009      |       danny's message d<br />danny        |   03/5/2009      |     30/5/2009      |       danny's message e<br />danny        |   03/6/2009      |     30/6/2009      |       danny's message f<br />chan          |   03/1/2009      |     30/1/2009      |       chan's message a<br />chan          |   03/2/2009      |     30/2/2009      |       chan's message b<br />chan          |   03/3/2009      |     30/3/2009      |       chan's message c<br />chan          |   03/4/2009      |     30/4/2009      |       chan's message d<br />chan          |   03/5/2009      |     30/5/2009      |       chan's message e<br />chan          |   03/6/2009      |     30/6/2009      |       chan's message f<br />.<br />.<br />.<br />-------------------------------------------------------------------------------------------<br /><br /><br />i want to print out latest date, and to match name and summary.<br />how can i do it?]]></description>
		<pubDate>Mon, 14 Sep 2009 19:37:37 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27620</guid>
	</item>
	<item>
		<title>Help For Sql Query</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27614</link>
		<description><![CDATA[I am working on a Stock calculation query.<br />I am working in VB express 2008 with MsAccess as database. <br />I searched some forums and with the help of that i am able to form the following query to calculate the balance of Stock.<br /><br />My tables in MsAccess are:<br /><b>ItemsTable </b><br />ITId ItemId Description <br />1 1 Coca Cola Normal <br />2 2 Coca Cola Zero <br /><br /><b>PurchaseTable </b><br />PId PDate ItemId Price Quantity Amount <br />1 28/8/2009 1 1,00 10 10,00 <br />2 28/8/2009 2 1,00 5 5,00 <br />3 29/8/2009 1 1,00 5 5,00 <br />4 29/8/2009 2 1,00 10 10,00 <br />5 30/8/2009 1 1,00 10 10,00 <br />6 30/8/2009 2 1,00 5 5,00 <br /><br /><b>SalesTable </b><br />SId SDate ItemId Price Quantity Amount <br />1 30/8/2009 1 2,70 2 5,40 <br />2 30/8/2009 2 2,70 3 7,10 <br />3 31/8/2009 1 2,70 1 2,70 <br />4 31/8/2009 2 2,70 2 2,70 <br /><br />My query is as under:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--> Dim cmdText As String = &#34;Select a.ItemId,i.Description,Sum&#40;QuantityPurchased&#41; AS QuantityPurchased,Sum&#40;QuantitySold&#41; AS QuantitySold, &#34; & _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#34;&#40;Sum&#40;QuantityPurchased&#41; - Sum&#40;QuantitySold&#41;&#41; as Balance&nbsp;&nbsp;&#34; & _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#34;From &#34; & _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#34;&#40; SELECT pt.PDate as TransactionDate, pt.ItemId, pt.Quantity AS QuantityPurchased, &#34; & _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#34;0 AS QuantitySold FROM PurchaseTable pt &#34; & _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#34;UNION ALL &#34; & _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#34;Select st.SDate as TransactionDate, st.ItemId, 0 AS QuantityPurchased, &#34; & _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#34;st.Quantity AS QuantitySold &#34; & _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#34;From SalesTable st &#41; a &#34; & _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#34;Join ItemsTable i On a.ItemId = i.ItemId&nbsp;&nbsp;&#34; & _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#34;WHERE a.TransactionDate Between @START and @END &#34; & _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#34;GROUP BY a.ItemId, i.Description &#34;<!--c2--></div><!--ec2--><br /><br />The above query is giving error as "Error at From clause". The query will calculate the balance of stock between interval of two dates and will display it in LIstview.<br />Please advise what i am doing wrong with this query.]]></description>
		<pubDate>Mon, 14 Sep 2009 15:13:32 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27614</guid>
	</item>
	<item>
		<title><![CDATA[[solved] Select Numbers Per Page]]></title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27583</link>
		<description><![CDATA[Hi,<br /><br />Lets say we have about 20 entries in table. 15 of them matches query example WHERE CATEGORY=1 LIMIT 10<br />Now, we want to show 10 of them per page. If I set $page = $_GET['page']; and use ?page=1 I'll got first 10th entries.<br />Then when I use ?page=2, I should get next five entries. But how to continue on 11th entry.<br /><br />What query should be used here?<br /><br />Note that in table we have more options where category is 2, 3, etc.<br /><br />Regards]]></description>
		<pubDate>Sat, 12 Sep 2009 20:19:00 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27583</guid>
	</item>
	<item>
		<title>Sql Query Not Updating In Ie</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27181</link>
		<description><![CDATA[I hope I'm asking this in the correct forum...<br /><br />There is a form on my website where you enter information, it stores it in the database, takes you to another page where you enter more info, etc.<br /><br />When you click the "back" button on a page (not the browser back button), it goes to the previous page, loads your information from the database and places it into the form so you can then modify it.  If you submit that form, it updates the info in the database.<br /><br />This works fine.  However, the problem I have is when you go back to the same page a second time, it does not display the modified information, but rather it shows the original info.  THIS IS ONLY AN ISSUE WITH IE.  It displays the updated info like it should in Firefox and Chrome.<br /><br />I have checked the database and it gets updated every time without fail.  I have checked the variables that store the information from the SQL query and they're empty until the call on the webpage.  So I really have no clue how IE is retrieving the original data when it no longer exists in the database.<br /><br />I am using Access 2003 for my database and Sambar as my web server.<br /><br />Any ideas?  Thanks!!]]></description>
		<pubDate>Thu, 10 Sep 2009 17:56:32 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27181</guid>
	</item>
	<item>
		<title><![CDATA[Primary & Foreign Keys]]></title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27168</link>
		<description><![CDATA[I'm currently going through a book which teaches you both PHP and MySQL, and I'm having a hard time going through the chapter which describes the KEYs and their use. The question is how do we create a foreign key?<br /><br />I had a look over some pieces of code, and as far as I can say, being given a <b>test_db</b> database, we've got two tables: <b>primary_table</b> and <b>foreign_table</b>. The former has a primary key called "id". The latter has only got a column named "id", and that's how we define a foreign key. In other words, SQL links them by itself. Am I right, or have I got it wrong? Any input is highly appreciated. Thanks in advance!]]></description>
		<pubDate>Wed, 09 Sep 2009 20:15:43 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27168</guid>
	</item>
	<item>
		<title>Union And Option Highlighting</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27156</link>
		<description><![CDATA[I have a drop-down menu where user should see all available option with already selected options highlighted. I use the following query to get relevant results:<br /><div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>$q2 = '(SELECT ageing_id, ageing_name, 1 AS selected FROM ageing as a, productAge AS p WHERE p.product_id=' . $id . ' AND p.age_id=a.ageing_id)';<br />$q2 .= ' UNION ';<br />$q2 .= '(SELECT ageing_id, ageing_name, 0 AS selected FROM ageing)';<br />$q2 .= ' ORDER BY ageing_id';</div><br /><br />My problem, the data is displayed twice for those where the already selected options, the only way to have one being displayed is to take:<br />'1 AS selected' and '0 AS selected' out. But this is no good as I do not know how else I can distinguish where data is coming from to highlight the relevant options as:<br />if ($ageing_id['selected']) echo ' selected="selected"';<br />Highlighting in general works fine.<br /><br />So, how can I mark first section of query as results that should be highlighted without displaying everything twice? DISTINCT is standard anyway and does not help in this case...<br /><br />Son]]></description>
		<pubDate>Wed, 09 Sep 2009 08:02:55 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27156</guid>
	</item>
	<item>
		<title>Transactions From Php Scripts</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27148</link>
		<description>I have several PHP scripts in my site, for example logging, logging out, adding items to your basket, etc.  I was wondering what the arguments are in favour of, and against, using stored transactions.  On the face of it, it seems like they might make things simpler, but is there any difference from just handwriting the code into a PHP script?  Are there security concerns?  Are there any real differences at all apart from the rollback feature?</description>
		<pubDate>Tue, 08 Sep 2009 14:19:54 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27148</guid>
	</item>
	<item>
		<title>Sql Query</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27127</link>
		<description><![CDATA[Hello,<br /><br />I have trouble with one sql query<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->$poruke_re = mysql_query&#40;&#34;SELECT ID_MSG FROM $table_messages WHERE ID_TOPIC='$boardch_subject_id' GROUP BY ID_MSG&#34;&#41;;<br />while&#40;$pod_teme = mysql_fetch_array&#40;$poruke_re&#41;&#41; {<br />&nbsp;&nbsp;&nbsp;&nbsp;echo &#34;&#60;br&#62;&#34; . $pod_teme&#91;'ID_MSG'&#93;;<br />}<!--c2--></div><!--ec2--><br /><br />Results for this query are 20, 22, 23, 24.<br />What is my problem. I'm getting result four times. When there was just 20, 22, 23 that was tree times etc.<br /><br />I used br tag and expected to get this:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->20<br />22<br />23<br />24<!--c2--></div><!--ec2--><br /><br />But for some reason (I'm asking you why), I'm getting this:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->20<br />22<br />23<br />24<br /><br /><br />20<br />22<br />23<br />24<br /><br /><br />20<br />22<br />23<br />24<br /><br /><br />20<br />22<br />23<br />24<!--c2--></div><!--ec2--><br /><br />Thanks for any help, I'm gonna get crazy becouse of this.<br /><br /><img src="http://w3schools.invisionzone.com/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />]]></description>
		<pubDate>Mon, 07 Sep 2009 12:17:38 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27127</guid>
	</item>
	<item>
		<title>Database Search Query To Return The Matching Column</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27116</link>
		<description><![CDATA[I have an Application which queries multiple tables in a SQL Server 2005 Database.<br /><br />For example I have 3 tables, for simplicity sake lets say the tables are called t1, t2 and t3<br /><br />And in those tables I am checking columns for a given value, lets say the columns are called c1 and c2.<br /><br />So, I want to return an extra column/field that states the name of the column which contains the given search value.<br /><br />Is this possible in a query?]]></description>
		<pubDate>Mon, 07 Sep 2009 03:27:16 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27116</guid>
	</item>
	<item>
		<title>Mysql V. Mssql?</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27056</link>
		<description><![CDATA[Hello, I have a couple of questions about MicrosoftSQL.  I recently enrolled in a class for college called "Intro to Business Software" which is required by my major(web development).  The class required that I purchase Microsoft Office 2007 so I can do assignments at home.  MySQL and PHP have been my primary resources for managing dynamic web content and databases.  Since the Office purchase includes Microsoft Access(which is one of the programs covered in the class), I was wondering if I would be able to use the Access databases I create on the web.  How different is MySQL from MSSQL as far as PHP coding is concerned, and is it difficult to learn MSSQL syntax for PHP?<br /><br />Also, if this would be a good route for me to take, are there any web hosts that you'd recommend?  They would need to support Apache and obviously MSSQL.  Does not have to be free, but under $15/month.]]></description>
		<pubDate>Wed, 02 Sep 2009 18:51:40 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27056</guid>
	</item>
	<item>
		<title>Order By (exclude Numbers Untill Letters Checked)</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27043</link>
		<description><![CDATA[Hello, I've got a query working<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->$gmenu=mysql_query&#40;&#34;SELECT * FROM products GROUP BY cat ORDER BY cat&#34;&#41;;<br />while&#40;$smenu=mysql_fetch_array&#40;$gmenu&#41;&#41;<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo'&#60;div style=&#34;background-color&#58;#999999;border&#58;#000000 thin solid;width&#58;100%;&#34;&#62;'.stripslashes&#40;$smenu&#91;&#34;cat&#34;&#93;&#41;.'&#60;/div&#62;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&#60;div style=&#34;background-color&#58;#CCCCCC;width&#58;100%;border&#58;#000000 thin solid;&#34; id=&#34;'.$smenu&#91;&#34;Name&#34;&#93;.'&#34;&#62;';<br />&nbsp;&nbsp;&nbsp;&nbsp;$g=mysql_query&#40;&#34;SELECT * FROM products WHERE cat='{$smenu&#91;'cat'&#93;}' GROUP BY size ORDER BY size&#34;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;while&#40;$s=mysql_fetch_array&#40;$g&#41;&#41;<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo'-&#60;a style=&#34;width&#58;100px;color&#58;#666666;&#34; href=&#34;Products.php?cat='.$s&#91;&#34;cat&#34;&#93;.'&Size='.$s&#91;&#34;size&#34;&#93;.'&#34;&#62;'.$s&#91;&#34;size&#34;&#93;.'&#60;/a&#62;&#60;br /&#62;';<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;echo'&#60;/div&#62;';<br /><br />}<br />}<!--c2--></div><!--ec2--><br /><br /><br />okay i'm aware changing line 10 to this<br /><b>g=mysql_query("SELECT * FROM products WHERE cat='{$smenu['cat']}' GROUP BY size ORDER BY size  LIKE '%E'");</b><br />will order the data so the values are in D,E categories but not numerical aswell.<br /><br />Now, cat has values such as 32D 34D  and 32E and 34E obioulsy it gets sorted like 32D,32E,32D then 34E<br />now what i'm waiting it to keep all the D's together then E's together so it would show up like this 32D,34D, 32E and then 34E<br />now i know very little about SQL and was wonder if their was an option to search by the final letter then any letters or search once for letters then order by that and then order again by the full value.<br /><br />however please note their may be more than one letter at the end for example it might be DD or DE or even CD etc.<br /><br />I'm doing this in PHP if anyone wants to help. i can make while statements etc. but it's the SQL part i'm not understanding.<br /><br />Thanks<br />Jny]]></description>
		<pubDate>Wed, 02 Sep 2009 06:46:12 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27043</guid>
	</item>
	<item>
		<title>Incorrect Syntax Error When Executing Query</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=27013</link>
		<description><![CDATA[I created a query using Toad for Oracle 9.0.1, and it executed without errors. I was able to use the SQL button to save it as a file and export it as an .XLS spreadsheet. I then opened the file using SQL Server Mgmt Studio 2005, and clicked on the 'parse' button, which was successful, however, when I clicked on the 'execute' icon, the following error appeared....<br /><br />Msg 156, Level 15, State 1, Line 9<br />Incorrect syntax near the keyword 'AND'.<br /><br />I know it's a Monday, but the code appears to be fine to me...so now I'm relying on an outside pair of eyes to help me resolve this error...<br />Here's what the code looks like below:<br /><div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>SELECT   tidapmst.created_by, tidapmst.create_date, tidapmst.invoice_no,<br />         tidapmst.invoice_date, tidapmst.vendor_code, tidapmst.facility<br />    FROM cb10.tidapmst<br />   WHERE ((tidapmst.invoice_date BETWEEN '20090701' AND '20090731'))<br />     AND ((tidapmst.facility = 'BIG'))<br />     AND ((tidapmst.created_by &lt;&gt; 'APBAK'))<br />     AND ((tidapmst.created_by &lt;&gt; 'ADASCO'))<br />ORDER BY tidapmst.created_by ASC AND tidapmst.created_date ASC</div><br /><br />I appreciate your help and guidance on this simple dilemma.<br /><br />Thanks!<br />]]></description>
		<pubDate>Mon, 31 Aug 2009 11:17:31 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=27013</guid>
	</item>
	<item>
		<title>Ahh, I Need Help With My Basket Script</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26985</link>
		<description><![CDATA[I am going mad here.  I keep thinking I've cracked what I have to do, but I can't keep it straight in my head.<br /><br />When someone is browsing my site, I want them to be able to add items to their basket, associated in my database table sessionBasket with their session id.  Then, when they sign in, I want to get all items with the current session id and put them in another table, userBasket.  <br /><br />When users are signed in, though, I want the items in userBasket to persist, so next time if someone is browsing, not signed in, and they add an item to their basket, when they sign in, I want to effectively merge the old userBasket with the new userBasket.<br /><br />So, I need to select all items from the sessionBasket table first and for each one, check if it's product_id matches a row in the userBasket that is associated with the current userid.  If it is, I need to get the old quantity from the userBasket and add to it the new quantity (from the sessionBasket) in an update query.<br /><br />If there isn't already a product with the product_id in the userBasket table, I make an insert query and move on to the next item in the sessionBasket table that has the right session id.<br /><br />I have strarted to code this but I can't keep it straight.  Here is what I have (so far only for users logging in with their username and password, not their email address, but it's a straight copy of the first part.<br /><br />Here is it - help me sort it out, please!!<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->&#60;?php<br />session_start&#40;&#41;;<br />include_once&#40;&#34;db_include.php5&#34;&#41;;<br />doDB&#40;&#41;;<br /><br />//check for required fields from the form<br />if &#40;&#40;empty&#40;$_POST&#91;'username'&#93;&#41; && empty&#40;$_POST&#91;'email'&#93;&#41;&#41; || empty&#40;$_POST&#91;'password'&#93;&#41;&#41; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_SESSION&#91;&#34;username&#34;&#93; = trim&#40;mysqli_real_escape_string&#40;$mysqli, check_chars_username&#40;$_POST&#91;&#34;username&#34;&#93;&#41;&#41;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_SESSION&#91;&#34;email&#34;&#93; = trim&#40;mysqli_real_escape_string&#40;check_chars_username&#40;$_POST&#91;&#34;email&#34;&#93;&#41;&#41;&#41;;<br /><br />header&#40;&#34;Location&#58; loginform.php5?error=ef&#34;&#41;;<br />exit;<br />}&nbsp;&nbsp; else if&#40;$_POST&#91;&#34;username&#34;&#93; && $_POST&#91;&#34;password&#34;&#93;&#41;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;//create and issue the query<br />&nbsp;&nbsp;&nbsp;&nbsp;$sql = &#34;SELECT id, username, email FROM aromaMaster WHERE username='&#34;.$_POST&#91;&#34;username&#34;&#93;.&#34;' AND password=PASSWORD&#40;'&#34;.$_POST&#91;&#34;password&#34;&#93;.&#34;'&#41;&#34;;<br />&nbsp;&nbsp;&nbsp;&nbsp;$sql_res =mysqli_query&#40;$mysqli, $sql&#41; or die&#40;mysqli_error&#40;$mysqli&#41;&#41;;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;//get the number of rows in the result set; should be 1 if a match<br />&nbsp;&nbsp;&nbsp;&nbsp;if&#40;mysqli_num_rows&#40;$sql_res&#41; != 0&#41; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//if authorized, get the userid<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&#40;$info = mysqli_fetch_array&#40;$sql_res&#41;&#41; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$userid = $info&#91;&#34;id&#34;&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$username = stripslashes&#40;$info&#91;&#34;username&#34;&#93;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$email = stripslashes&#40;$info&#91;&#34;email&#34;&#93;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//set session variables<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_SESSION&#91;&#34;userid&#34;&#93; = $userid;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_SESSION&#91;&#34;username&#34;&#93; = $username;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_SESSION&#91;&#34;email&#34;&#93; = $email;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;session_write_close&#40;&#41;;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//select all rows in sessionBasket with the current session id<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$select_sql = &#34;SELECT product_id, qty, notes FROM sessionBasket WHERE usersessid = '&#34;.session_id&#40;&#41;.&#34;'&#34;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$select_res = mysqli_query&#40;$mysqli, $select_sql&#41; or die&#40;mysqli_error&#40;$mysqli&#41;&#41;;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$newInfo = mysqli_fetch_array&#40;$select_res&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$newQty = $newInfo&#91;&#34;qty&#34;&#93;;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//if no rows, then do nothing<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&#40;mysqli_num_rows&#40;$select_res&#41; == 0&#41; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;header&#40;&#34;Location&#58; your_basket.php5?res=loggedin_noitems&#34;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit&#40;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if&#40;mysqli_num_rows&#40;$select_res&#41; &#62; 0&#41; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//else, for each item, check if there is an existing item of that kind in the basket<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&#40;$row = mysqli_fetch_array&#40;$select_res&#41;&#41; {<br /><br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//check for pre-existing basket items for this account<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$old_items_sql = &#34;SELECT qty FROM userBasket WHERE userid = '&#34;.$userid.&#34;' AND product_id = '&#34;.$product_id.&#34;'&#34;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$old_items_res = mysqli_query&#40;$mysqli, $old_items_sql&#41; or die&#40;mysqli_error&#40;$mysqli&#41;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&#40;mysqli_num_rows&#40;$old_items_res&#41; &#62; 0&#41; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//pre-existing items - update qty<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$oldInfo = mysqli_fetch_array&#40;$old_items_res&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$oldQty =&nbsp;&nbsp;$oldInfo&#91;&#34;qty&#34;&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$update_sql = &#34;UPDATE userBasket SET qty=&#34;.intval&#40;$oldQty+$newQty&#41;.&#34; WHERE product_id = '&#34;.$product_id.&#34;' AND usersessid = '&#34;.session_id&#40;&#41;;&#34;'&#34;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$update_res = mysqli_query&#40;$update_sql&#41; or die&#40;mysqli_error&#40;$mysqli&#41;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&#40;mysqli_num_rows&#40;$update_res&#41; == 0&#41; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//failed<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;header&#40;&#34;Location&#58;your_basket.php5?failed=update5060&#34;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit&#40;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if&#40;mysqli_num_rows&#40;$update_res&#41; &#62; 0&#41; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//success<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;header&#40;&#34;Location&#58;your_basket.php?success=update5060&#34;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit&#40;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else if&#40;mysqli_num_rows&#40;$old_items_res&#41; == 0&#41; {<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//no preexisting items - insert the current ones<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$insert_new_sql = &#34;INSERT INTO userBasket &#40;userid, usersessid, date_added, product_id, qty, notes&#41; VALUES &#40;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'&#34;.$userid.&#34;',<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'&#34;.session_id&#40;&#41;.&#34;',<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;now&#40;&#41;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'&#34;.$product_id.&#34;',<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'&#34;.$qty.&#34;',<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'&#34;.$notes.&#34;'&#41;&#34;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$insert_res = mysqli_query&#40;$mysqli, $insert_new_sql&#41; or die&#40;mysqli_error&#40;$mysqli&#41;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mysqli_free_result&#40;$sql_res&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//redirect to main page<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;header&#40;&#34;Location&#58; loginredirect.php5&#34;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit; }<br /><br /><br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;} else if&#40;$_POST&#91;&#34;email&#34;&#93; && $_POST&#91;&#34;password&#34;&#93;&#41; {<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//create and issue the query<br />&nbsp;&nbsp;&nbsp;&nbsp;$sql = &#34;SELECT id, username FROM aromaMaster WHERE email='&#34;.$_POST&#91;&#34;email&#34;&#93;.&#34;' AND password=PASSWORD&#40;'&#34;.$_POST&#91;&#34;password&#34;&#93;.&#34;'&#41;&#34;;<br />&nbsp;&nbsp;&nbsp;&nbsp;$sql_res =mysqli_query&#40;$mysqli, $sql&#41; or die&#40;mysqli_error&#40;$mysqli&#41;&#41;;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;//get the number of rows in the result set; should be 1 if a match<br />&nbsp;&nbsp;&nbsp;&nbsp;if&#40;mysqli_num_rows&#40;$sql_res&#41; != 0&#41; {<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//if authorized, get the userid<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&#40;$info = mysqli_fetch_array&#40;$sql_res&#41;&#41; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$userid = $info&#91;&#34;id&#34;&#93;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$username = stripslashes&#40;$info&#91;&#34;username&#34;&#93;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$email = stripslashes&#40;$info&#91;&#34;email&#34;&#93;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//set session variables<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_SESSION&#91;&#34;userid&#34;&#93; = $userid;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_SESSION&#91;&#34;username&#34;&#93; = $username;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_SESSION&#91;&#34;email&#34;&#93; = $email;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;session_write_close&#40;&#41;;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mysqli_free_result&#40;$sql_res&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$userupdate_sql = &#34;UPDATE sessionBasket SET userid = '&#34;.$userid.&#34;' WHERE usersessid='&#34;.session_id&#40;&#41;.&#34;'&#34;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$userupdate_res = mysqli_query&#40;$mysqli, $userupdate_sql&#41; or die&#40;mysqli_error&#40;$mysqli&#41;&#41;;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//redirect to main page<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;header&#40;&#34;Location&#58; loginredirect.php5&#34;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//redirect back to login form<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_SESSION&#91;&#34;username&#34;&#93; = trim&#40;stripslashes&#40;check_chars_username&#40;$_POST&#91;&#34;username&#34;&#93;&#41;&#41;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_SESSION&#91;&#34;email&#34;&#93; = trim&#40;stripslashes&#40;check_chars_username&#40;$_POST&#91;&#34;email&#34;&#93;&#41;&#41;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;session_write_close&#40;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;header&#40;&#34;Location&#58; loginform.php5?error=ef&#34;&#41;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit;<br />&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;}<br />?&#62;<!--c2--></div><!--ec2-->]]></description>
		<pubDate>Fri, 28 Aug 2009 20:42:19 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26985</guid>
	</item>
	<item>
		<title>Speed Up Search Of Database</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26976</link>
		<description><![CDATA[I need to speed up the search of the database I am using. It currently takes upto 20 seconds to return results. The database is made up of 27 tables totalling 350,000+ rows and around 450mb. A part of the code I am using is below. I ideally could also do with selecting everything rather than the first 3 columns but the total of all columns is over 30.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->SELECT SET1, SET2, SET3 FROM table1 WHERE NAME LIKE '%$terms%' UNION ALL<!--c2--></div><!--ec2--><br /><br />Any ideas?]]></description>
		<pubDate>Fri, 28 Aug 2009 11:58:16 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26976</guid>
	</item>
	<item>
		<title>Mysql Merge Rows?</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26967</link>
		<description><![CDATA[I want the option of merging rows in a table.  The rows might look like this:<br /><br /><u><br />id....sessionid....userid....product_id....qty   </u><br />1....abcdef............3..............1...........2<br />2......ghijkl............3..............1...........5<br />3.....mnopq...........3..............2...........3<br /><br />I want to merge rows with the same product id, the same user id, regardless of session id, and to have the qty column become a sum total of all the ones being merged.  If possible, the most recent session id (the one that the user has currently been assigned) should survive.  So, this would be the end result:<br /><br /><u><br />id....sessionid....userid....product_id....qty   </u><br />2......ghijkl............3..............1...........7<br />3.....mnopq...........3..............2...........3<br /><br />I don't know if this is possible, but if it is, some ideas on the sort of query necessary would be great.  Thanks!]]></description>
		<pubDate>Fri, 28 Aug 2009 06:40:26 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26967</guid>
	</item>
	<item>
		<title>Add To Basket Script</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26944</link>
		<description><![CDATA[As mentioned in another thread, I'm writing a script to let users place items in their baskets.  It is very complex so far, and I would like to talk it through with someone to see if they can suggest better design or tidy the current design up.  Here is the code I have, which doesn't work very well (i.e. has errors that I haven't yet resolved), with comments to show my intentions:<br /><br />&lt;?php<br />session_start();<br />include_once("db_include.php5");<br />doDB();<br /><br /><br />if(!$_GET["productid"] || !$_GET["qty"]) {<br /><b>//the user has entered the address directly into their address bar, send them away (if=1 to let me know where the script branched)</b><br />  header("Location:index.php5?if=1");<br />  exit();<br />}<br /><br /><b>//do select query to verify item id is valid, in case they entered data into the query string or the item has been removed from db</b><br />$check_sql = "SELECT * FROM aromaProducts1 WHERE id='".$_GET["productid"]."'";<br />$check_res = mysqli_query($mysqli, $check_sql) or die(mysqli_error($mysqli));<br /><br />if(mysqli_num_rows($check_res) == 0) {<br /><b>//item doesn't exist, redirect user</b><br />  header("Location:index.php5?if=2");<br />  exit();<br />} else if(mysqli_num_rows($check_res) != 0) {<br /><b>//item exists<br />  //do select query to check for item id already in basket - if this item is already in the table associated with the user's session id (which will be added every time an item is), then we want to change the quantity only</b><br />  $duplicate_sql = "SELECT qty FROM sessionBasket WHERE product_id='".$_GET["productid"]."' AND usersessid='".session_id()."'";<br />  $duplicate_res = mysqli_query($mysqli, $duplicate_sql) or die(mysqli_error($mysqli));<br />  <br />  if(mysqli_num_rows($duplicate_res) != 0) {<br /><b>    //item in basket - add another - fetch current quantity and add new quantity</b><br />    $basketInfo = mysqli_fetch_array($duplicate_res);<br />    $currQty = $basket_info["qty"];<br />    $add_sql = "UPDATE sessionBasket SET qty='".($_GET["qty"]+$currQty)."' WHERE usersessid='".session_id()."'AND product_id='".$_GET["productid"]."'";<br />    $add_res = mysqli_query($mysqli, $add_sql) or die(mysqli_error($mysqli));<br />    <br />    if($add_res !== TRUE) {<br /><b>      //wasn't updated for some reason - this is where my script currently breaks</b><br />      header("Location:basketfailredirect.php5?error=add");<br />      exit();<br />    } else if($add_res === TRUE) {<br /> <b>     //was updated - send them away</b><br />      header("basket.php5?res=add");<br />      exit();<br />    }<br /><br /><br />} else if(mysqli_num_rows($duplicate_res) == 0) {<br /><b>    //no existing items in basket, so we want to add the current item info associated with the user's id/session id</b><br /><br />  $info = mysqli_fetch_array($check_res);<br /><b>//fetch product id, passed in query string from the product info page</b><br />  $productid = $_GET["productid"];<br />  <br /><b>  //sanitize possible inputs, if set - notes is a field added to the product info page for custom products, and we want to sanitize it if it's set</b><br />  $notes = isset($_GET["notes"])?trim(mysqli_real_escape_string(check_chars_mailto($_GET["notes"]))):"";<br /><b>//if the user is logged in, their userid is stored in the session variable</b><br />  $userid = $_SESSION["userid"]?$_SESSION["userid"]:"";<br /><b>//not sure about the keep alive option - i.e. store basket contents even if the user doesnt register/sign in, but keeping the option there</b><br />  $alive = $_SESSION["alive"]?$_SESSION["alive"]:"no";<br /><br /><br />  //insert query<br />  $insert_sql = "INSERT INTO sessionBasket (userid, usersessid, date_added, keep_alive, product_id, qty, notes) VALUES (<br />  '".$userid."',<br />  '".$_SESSION["PHPSESSID"]."',<br />  now(),<br />  '".$alive."',<br />  '".$productid."',<br />  '".$_GET["qty"]."',<br />  '".htmlspecialchars($notes)."')";<br />  $insert_res = mysqli_query($mysqli, $insert_sql) or die(mysqli_error($mysqli));<br />  <br />  if($insert_res === TRUE) {<br /><b>    //success</b><br />    header("Location:basket.php5?res=add");<br />    exit();<br />  } else if($insert_res !== TRUE) {<br /><b>    //fail</b><br />    header("Location:basketfailredirect.php5?error=add2");<br />    exit();<br />  }<br />  }<br />}<br />?&gt;<br /><br /><br />It's pretty complicated for me - I want to allow empty fields, add the userid if it's available (which is missing from my UPDATE query)...  Is this a million miles from a good design, or what? <br /><br />Edit: also, when I try to add items to the basket, I now get an error: internal server error 500.  I suspect this is due to bad coding because my search results and product view pages work and they use the same server and the same database as this script.<br /><br />Edit 2: I changed $_SESSION["SESSID"] for session_id() which works better.  I can now add items to the basket, but if I add an item and then add the same item, the update qty branch doesn't work - I get the error 500 again.  If the user is signed in, their userid gets added correctly and adding new items is fine - so it's 90% there.]]></description>
		<pubDate>Wed, 26 Aug 2009 20:39:35 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26944</guid>
	</item>
	<item>
		<title>Concise Checking Of Field Values On Insert Query</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26943</link>
		<description><![CDATA[I am writing a script to add items to a shopping basket.  My shopping basket table has fields for the userid, product id, session id, notes and a few others.  Some of the fields can be blank.  For example:<br /><br />if someone isn't signed in, then I will store their session id in the table and, if they sign in, add their userid so I have a permanant way to match the items in the table to the user.  If they are, I'll add the userid.  When it comes to the INSERT query, can I do something like this:<br /><br />$add_sql = "INSERT into sessionBasket (userid) VALUES (<br />'". isset($_SESSION["userid"]) ? $_SESSION["userid"] : "" ."'";<br /><br />It would save me so much time on variable checking and branching because people could be signed in or not, items could have notes or not, that sort of thing.]]></description>
		<pubDate>Wed, 26 Aug 2009 18:56:50 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26943</guid>
	</item>
	<item>
		<title>Adding Fulltext Index</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26914</link>
		<description><![CDATA[I am trying to implement a search function on a database table using query expansion, and I'm aware that I have to add the FULLTEXT index on the fields I want to become searchable.  I have tried to do this and got no errors from PHPMyAdmin, but when I examine the structure of the table the cardinality of the FULLTEXT index is 0.  I have tried inidividually setting the FULLTEXT index and it seems to work, but my serach returns the error: <br />Can't find FULLTEXT index matching the column list<br /><br />Any ideas what's going wrong?]]></description>
		<pubDate>Tue, 25 Aug 2009 10:11:59 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26914</guid>
	</item>
	<item>
		<title>Query Problem, Where Clause</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26888</link>
		<description><![CDATA[The following query works well in phpMyAdmin:<br /><div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>SELECT ageing_id, ageing_name FROM ageing WHERE ageing_id IN (SELECT age_id FROM productAge WHERE product_id = 30)</div><br /><br />Running same query does not display the select that receives data from this query. The code for this is:<br /><div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>if (mysqli_num_rows($ageing_result) &gt; 0)<br />		{<br />		echo "&lt;select name=&#092;"ageing&#092;" id=&#092;"ageing&#092;"&gt;&#092;n";<br />		echo "&lt;option value=&#092;"0&#092;"&gt;Please select...&lt;/option&gt;";<br />			while ($row = mysqli_fetch_array ($ageing_result, MYSQLI_ASSOC))<br />			{<br />			echo "&lt;option value=&#092;"{$row['ageing_id']}&#092;"";<br />		<br />			echo "&gt;{$row['ageing_name']}&lt;/option&gt;&#092;n";<br />			}<br />		echo "&lt;/select&gt;";</div><br /><br />Taking out 'WHERE ageing_id IN (SELECT age_id FROM productAge WHERE product_id = 30)' from query makes it work, but I only want to have options of ages that are for selected product_id appliable (stored in productAge). As it is working without fault in phpMyAdmin (and shows right set of data) am a bit confused now as why it won't work. <br /><br />Any ideas?<br /><br />Son]]></description>
		<pubDate>Mon, 24 Aug 2009 09:49:15 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26888</guid>
	</item>
	<item>
		<title>Insert Problem</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26870</link>
		<description><![CDATA[Hello,<br /><br />I've somewhat recently started to learn PHP/SQL. I've managed to make forms that submit to the database just fine, but with on I'm experiencing the following error:<br /><br /><b>Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc, version, size, comp, link) VALUES ('a',now(),'b','c','d','i','e','f','g'' at line 1</b><br /><br />And here's the php code off the page, the error occurs once the submit button is pressed. The connection information (datebase, username, password) have been edited out.<br /><br /><div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'><br />&lt;?PHP<br />session_start();<br />$con = mysql_connect("<b>my host</b>","<b>my username</b>","<b>my password</b>");<br />if (!$con)<br />  {<br />  die('Could not connect: ' . mysql_error());<br />  }<br /><br />mysql_select_db("<b>my database</b>", $con);<br /><br />if (isset ($_POST[Submit]))<br />{ <br />    $title = htmlspecialchars(strip_tags($_POST['title']));<br />    $thumb = htmlspecialchars(strip_tags($_POST['thumb']));<br />    $screen = htmlspecialchars(strip_tags($_POST['screen']));<br />    $screent = htmlspecialchars(strip_tags($_POST['screent']));<br />    $version = htmlspecialchars(strip_tags($_POST['version']));<br />    $size = htmlspecialchars(strip_tags($_POST['size']));<br />    $comp = htmlspecialchars(strip_tags($_POST['comp']));<br />    $link = htmlspecialchars(strip_tags($_POST['link']));<br />    $desc = $_POST['desc'];<br /><br />    $desc = nl2br($desc);<br /><br />    if (!get_magic_quotes_gpc()) {<br />        $title = addslashes($title);<br />        $thumb = addslashes($thumb);<br />        $screen = addslashes($screen);<br />        $screent = addslashes($screent);<br />        $version = addslashes($version);<br />        $size = addslashes($size);<br />        $comp = addslashes($comp);<br />        $link = addslashes($link);<br />        $desc = addslashes($desc);<br />     }<br /><br />$sql="INSERT INTO Games (title, date, thumb, screen, screent, desc, version, size, comp, link) <br />VALUES ('$title',now(),'$thumb','$screen','$screent','$desc','$version','$size','$comp','$link')";<br /><br />if (!mysql_query($sql,$con))<br />  {<br />  die('Error: ' . mysql_error());<br />  }<br /><br />}<br /><br />if (!isset($_SESSION['user'])){echo "You must log in. &lt;/div&gt;&lt;/div&gt;"; include('footer.php'); echo "&lt;/body&gt;&lt;/html&gt;"; exit;}<br />echo "Hello, NT. You are logged in. You are adding a game.&lt;br /&gt; &lt;br /&gt;<br /><br />&lt;form name='gamesubmit' id='gamesubmit' method='post' action=''&gt;<br />&lt;table&gt;<br />&lt;tr&gt;<br />&lt;td class='td' valign='top'&gt;<br />&lt;input type='text' name='title' class='forminput' maxlength='25' /&gt; Title&lt;br /&gt;&lt;br /&gt;<br />&lt;input type='text' name='thumb' class='forminput' maxlength='50' /&gt; Thumbnail&lt;br /&gt; &lt;br /&gt;<br />&lt;input type='text' name='screen' class='forminput' maxlength='100' /&gt; Screenshot&lt;br /&gt; &lt;br /&gt;<br />&lt;input type='text' name='screent' class='forminput' maxlength='100' /&gt; Screenshot 2&lt;br /&gt; &lt;br /&gt;<br />&lt;input type='text' name='version' class='forminput' maxlength='100' /&gt; Version&lt;br /&gt; &lt;br /&gt;<br />&lt;input type='text' name='size' class='forminput' maxlength='100' /&gt; Size&lt;br /&gt; &lt;br /&gt;<br />&lt;input type='text' name='comp' class='forminput' maxlength='100' /&gt; Compatible&lt;br /&gt; &lt;br /&gt;<br />&lt;input type='text' name='link' class='forminput' maxlength='100' /&gt; File Link&lt;br /&gt; &lt;br /&gt;<br />&lt;textarea rows='7' cols='30' name='desc' class='forminput'&gt;&lt;/textarea&gt;&lt;br /&gt; &lt;br /&gt;<br />&lt;/td&gt;<br />&lt;/tr&gt;<br />&lt;/table&gt;<br />&lt;input type='submit' value='Submit' name='Submit' id='Submit' class='sub_button' /&gt;&lt;/form&gt;";<br /><br />mysql_close($con);<br />?&gt;<br /></div><br /><br />The field names in the database match up to the ones I've typed in the script, if any more information is needed, please say so.<br /><br />I appreciate any and all help or advice,<br />xNTx]]></description>
		<pubDate>Sat, 22 Aug 2009 21:43:56 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26870</guid>
	</item>
	<item>
		<title>Inserting Date And Time</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26848</link>
		<description><![CDATA[In W3schools SQL tutorial the format for inserting date and/or time fields is shown as e.g. '2009-09-25'. This does not work on my computer. However if i format the date as #2009-09-25# is works!<br />is this (#...#) a general way of formatting date/time entries?<br /><br />/jesper]]></description>
		<pubDate>Fri, 21 Aug 2009 07:28:10 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26848</guid>
	</item>
	<item>
		<title>Sql Query</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26843</link>
		<description><![CDATA[hi, i am thinking of a query for a search function that allows the user to search some columns of my database. however, the datatype are not the same as some is numeric while some is string. is this possible?<br /><br />i've tried this sql query below but it seems that some of it has been ignored.<br /><br />SELECT PersonDetails.OID, Address.Unit, PersonDetails.FirstName, PersonDetails.LastName, PersonDetails.ContactNo From Address, PersonDetails WHERE Address.Unit = 'input' OR PersonDetails.FirstName LIKE 'input%' OR PersonDetails.LastName LIKE 'input%' OR PersonDetails.OID = input AND Address.AddID = PersonDetails.AddID AND PersonDetails.Status = 'Active'<br /><br />The part (AND Address.AddID = PersonDetails.AddID AND PersonDetails.Status = 'Active') is ignored and everyone seems to live in unit 1A when the 'input' is 1A. Also, those who are not active are being displayed together in the same unit. If 'input' is s or l, it will displayed those whose firstname or lastname contains s or l.<br />]]></description>
		<pubDate>Thu, 20 Aug 2009 21:26:23 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26843</guid>
	</item>
	<item>
		<title>Error Message: Invalid Object Name</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26805</link>
		<description><![CDATA[I set up the following new query last evening whereby it parsed successfully and executed successfully, however, when I opened up the query this morning and ran the execute command, it gave the following error and I'm not sure why or what caused it to happen:<br /><br />Msg 208, Level 16, State 1, Line 1<br />Invalid object name 'jumbo'.<br />Msg 208, Level 16, State 1, Line 1<br />Invalid object name 'jumbo_audit'.<br /><br />I verified that there were no spelling errors and that the table names were valid/spelled correctly/has available data....here's the code below:<br /><br /><div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>SELECT jumbo.jumbo_id, jumbo.machine_id, jumbo.grade_spec, jumbo.ts_turned_up,<br />jumbo_audit.jumbo_id AS jumbo_audit_jumbo_id, jumbo_audit.mx_timestamp, jumbo_audit.mx_action_code, jumbo_audit.wgt_slabbed<br /><br />FROM jumbo INNER JOIN jumbo_audit ON jumbo.jumbo_id = jumbo_audit.jumbo_id<br /><br />WHERE (((jumbo.machine_id)='14') AND ((jumbo.ts_turned_up)&gt;=1246791600 And (jumbo.ts_turned_up)&lt;=1246877999));</div><br /><br />fyi...using SQL Server Management Studio 2005.<br />Thanks in advance for your assistance!]]></description>
		<pubDate>Wed, 19 Aug 2009 10:04:16 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26805</guid>
	</item>
	<item>
		<title>Change Order Of Displayed Items</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26783</link>
		<description><![CDATA[I have developed a basic product catalogue. The order of products on website overview page should be changeable from product admin area. <br /><br />How do you create an option in admin area to change the order? For example via select with arrow up and down which brings item one up or one down. What would be the term for such a thing?<br /><br />Son]]></description>
		<pubDate>Tue, 18 Aug 2009 15:55:39 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26783</guid>
	</item>
	<item>
		<title>Mysql Order By Question</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26755</link>
		<description><![CDATA[I've got a table with id, firstname, lastname and a reference code.  Anonymous clients have an id and a code, but the firstname and lastname fields are left blank.<br /><br />My query to produce a list of name is "SELECT * FROM &#96;clients&#96; ORDER BY &#96;lastname&#96;,&#96;firstname&#96;;" and then the php prints it all out.<br /><br />This worked well to start with but as the number of anonymous clients has grown all the blank clients are listed first followed by those with proper names listed A-Z.  As a way round this I have changed the ORDER BY to do lastname DESC, so now I get Z-A clients followed by the blanks - but it just doesn't look right.<br /><br />What I'd like to do is have the proper A-Z followed by the blanks.  Can this be done in a single query?  Or do I have to do one query with &#96;lastname&#96; not blank, stick the results into a php array, then do a second query with the blanks and add those to the array?<br /><br />What's the easiest way?]]></description>
		<pubDate>Sun, 16 Aug 2009 12:32:43 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26755</guid>
	</item>
	<item>
		<title>Storing Date And Time</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26753</link>
		<description><![CDATA[It seems like i've seen a few different ways to keep track of date/time... I am currently using the datetime field type of mysql and updating it with NOW(), although I'm thinking maybe I should have used UTC_timestamp?<br /><br />I'm just looking for whichever is most practical, efficient, and accurate for storing times for messages and posts and logs and such and being able to find the differences in time between two times or one time and the current time.... and make the time fit for the users timezone preference<br /><br />any thoughts/ideas?]]></description>
		<pubDate>Sat, 15 Aug 2009 22:24:15 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26753</guid>
	</item>
	<item>
		<title>Automatically Backup Database</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26668</link>
		<description><![CDATA[I am worried about forgetting to backup my website so I made a batch file to backup the folder. Now I want to add into the same batch that it backs up my mysql database also. Is this possible in a batch file? And if so does anyone know how to do it? The DBMS the database is in is phpmyadmin so i would have to remotely connect to it to download a specific database in it.<br />Any help is appreciated.]]></description>
		<pubDate>Tue, 11 Aug 2009 04:01:18 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26668</guid>
	</item>
	<item>
		<title>Union And Tables Query</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26654</link>
		<description>When using UNION to combine several tables and then performing a search of the results, is there a way to know which table each result comes from?</description>
		<pubDate>Mon, 10 Aug 2009 15:36:31 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26654</guid>
	</item>
	<item>
		<title>Logging User Information Each Time They Log In</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26623</link>
		<description><![CDATA[For security purposes we have decided that we want to log each users information each time they log in to our website. More specifically the ip address they log in from. This way if we need to ip ban a user, we can query all of the ips the user ever logged in on and ban those ips. Of course we will have a list of safe ips that will not be banned regardless.<br /><br />Is there a way to make a table for this in phpmyadmin (mysql)?<br /><br />Would need something that will hold the following information:<br />Username<br />Ip<br />Timestamp (M,D,Y ##:##)<br /><br />But If possible have a record for each user and a dropdown menu (like the lookup wizard) with the ips in it.<br /><br />Also if this is possible how would I INSERT it in and how could i SELECT it for a certain user showing all ips? (I can convert it to be used into php later)<br /><br />Thanks a bunch.]]></description>
		<pubDate>Sun, 09 Aug 2009 03:42:43 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26623</guid>
	</item>
	<item>
		<title>Problem With Localhost</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26620</link>
		<description><![CDATA[Hello all,<br /><br />i made a project in visual studio 2008 with .net frame work 2.0 and sql server 2005<br />its completelly run on vs 2008<br /><br /><br /><br />when i want run it on localhost it shows below error:::::::<br /><br /><br /><br /><br /><br /><br /><br /><br />An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.<br /><br /><br /><br /><b>Server Error in '/projectwork' Application.  </b><br /> <br /><b><i>An error has occurred while establishing a connection to the server.   When connecting to SQL Server 2005, this failure may be caused by the fact that  under the default settings SQL Server does not allow remote connections.  (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance  Specified)</i> </b><br /><!--fonto:Arial Helvetica Geneva SunSans-Regular sans-serif--><span style="font-family:Arial Helvetica Geneva SunSans-Regular sans-serif"><!--/fonto--><b>Description:  </b>An unhandled exception occurred during the execution of the current web  request. Please review the stack trace for more information about the error and  where it originated in the code. <br /><br /><b>Exception Details:  </b>System.Data.SqlClient.SqlException: An error has occurred while establishing  a connection to the server.  When connecting to SQL Server 2005, this failure  may be caused by the fact that under the default settings SQL Server does not  allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error  Locating Server/Instance Specified)<br /><br /><b>Source Error:</b> <br /><br />    Line 41:  Line 42:             cmd.CommandType = CommandType.StoredProcedure; <!--coloro:red--><span style="color:red"><!--/coloro-->Line 43:             cn.Open(); <!--colorc--></span><!--/colorc-->Line 44:  Line 45:             cmd.Parameters.AddWithValue("@id",Convert.ToString(c.id));<br /><b>Source  File: </b>C:&#092;Inetpub&#092;wwwroot&#092;my school&#092;App_Data&#092;sqldata.cs<b>    Line: </b>43  <br /><br /><b>Stack Trace:</b> <br /><br />    [SqlException (0x80131904): An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800131    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186    System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +737554    System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +114    System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +421    System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +181    System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +173    System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +357    System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +30    System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424    System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66    System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +494    System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82    System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105    System.Data.SqlClient.SqlConnection.Open() +111    my_school.sqldata.checklogin(classfile c) in C:&#092;Inetpub&#092;wwwroot&#092;my school&#092;App_Data&#092;sqldata.cs:43    my_school._Default.Button1_Click(Object sender, EventArgs e) in C:&#092;Inetpub&#092;wwwroot&#092;my school&#092;login.aspx.cs:37    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBa<br />ckEvent(String eventArgument) +7    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746 <br />  <b>Version Information:</b> Microsoft .NET Framework Version:2.0.50727.1433;  ASP.NET Version:2.0.50727.1433 <!--fontc--></span><!--/fontc--><br /><br /><br /><br /><br /><br /><br /><br /><br />thans for seeing my problem]]></description>
		<pubDate>Sun, 09 Aug 2009 02:10:57 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26620</guid>
	</item>
	<item>
		<title>Sorting By Number Of Entries</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26590</link>
		<description><![CDATA[I am trying to display an SQL table where-in I have a field entitled 'categories'. <br /><br />Lets say I have 5 entries entitles 'cars', 3 entilted trucks and 6 entitled 'Buses'<br /><br />I am looking to sort this data out by category and have the category occurring most (buses) list it's info first and then list each other category by number of occurrences thereafter. Can anyone help?]]></description>
		<pubDate>Fri, 07 Aug 2009 12:37:42 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26590</guid>
	</item>
	<item>
		<title>How To Extract Data To Display In Html Page For Product Information?</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26565</link>
		<description><![CDATA[how to extract data to display in html page for product information?<br /><br />any experts here, I have a question?<br /><br />if I want to access to MySQL database, then to get(extract) data parameters for product information listed herein below,<br /><br />ProductName:<br />ProductDescription:<br />Brand:<br />Price:<br /><br />how can I fulfill that function?<br /><br />maybe Javascript function needed?<br /><br />Thanks a lot]]></description>
		<pubDate>Thu, 06 Aug 2009 21:40:34 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26565</guid>
	</item>
	<item>
		<title>Problems With Order By</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26551</link>
		<description><![CDATA[Hi everybody!<br /><br />These days I make a customers management system as a local site.<br />I made a table to view all the registered customers ordered by their names using this command:<br /><br />SELECT FROM CUSTOMERS NAME, ID ORDER BY NAME;<br />Name field is VARCHAR type!<br />I use PHP:<br />mysql_fetch_assoc();<br /><br />But I have two problems:<br />1. Hebrew names are not correctly ordered( I see the 3rd letter first, the 1st letter after, and the last letter in the end).<br />2. Name in Hebrew and English are combined, I see some names in EN and after some in HEB, and it continues.<br /><br />I really need your help, I asked others and they have no idea how to fix the problem.<br /><br /><br />Thanks for every helper!]]></description>
		<pubDate>Thu, 06 Aug 2009 08:05:31 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26551</guid>
	</item>
	<item>
		<title>Merging The Stored Procedure Result In Single Table..problem</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26524</link>
		<description><![CDATA[Hi Good Morning Friends..<br /><br />Help me...<br /><br />I'm using sql server 2005 management studio...<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->SELECT *<br />FROM<br />&#40;SELECT z.zone_id AS Zones,z.zone_name AS ZoneName,count&#40;c.circle_id&#41; AS Circles,count&#40;c.trans_id&#41; AS Transfer,sum&#40;c.housescovered&#41; AS HousesCover,sum&#40;c.housesnotcovered&#41; AS HousesnotCover<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FROM zone_mas z<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;INNER JOIN circle_mas c<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ON z.zone_id=c.zone_id<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GROUP BY z.zone_id,z.zone_name&#41; a<br />INNER JOIN<br />&#40;<br />SELECT z.zone_id, count&#40;distinct s.loc_id&#41; AS Locations,count&#40;distinct s.veh_no&#41; AS Vehicles,sum&#40;s.bin_no&#41; AS Bins<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FROM Zone_mas z<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LEFT JOIN schedule_mas s<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;on s.zone_id=z.zone_id<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GROUP BY z.zone_id,z.zone_name&#41; b<br />ON a.Zones = b.zone_id<!--c2--></div><!--ec2--><br /><br />the solution is like this.....<br /><br />CZ Central Zone 4 4 0 0 <b>CZ</b> 0 0 NULL<br />EZ East Zone 3 3 123177 17578 <b>EZ</b> 185 8 132<br />NZ North Zone 4 4 0 0 <b>NZ</b> 0 0 NULL<br />SZ South Zone 3 3 0 0 <b>SZ</b> 0 0 NULL<br />WZ West Zone 4 4 151534 6620 <b>WZ</b> 0 0 NULL<br /><br />my probelm is that i don't want to print the bolded column again because it is at first..<br /><br />I'm using this code to run in php<br /><br />executing in php and by executing i need to store the result and print...<br /><br />CZ Central Zone 4 4 0 0 0 0 NULL<br />EZ East Zone 3 3 123177 17578  185 8 132<br />NZ North Zone 4 4 0 0  0 0 NULL<br />SZ South Zone 3 3 0 0  0 0 NULL<br />WZ West Zone 4 4 151534 6620  0 0 NULL<br /><br />I want the output like this...<br /><br />can u give me information that can we handle output columns... to print...<br /><br />Thanks In Advance...<br /><br /><br /><br /><br />]]></description>
		<pubDate>Wed, 05 Aug 2009 02:55:13 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26524</guid>
	</item>
	<item>
		<title>Complicated Query</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26475</link>
		<description><![CDATA[I am a little baffled by this query:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->$verify_sql = &#34;SELECT ft.topic_id, ft.topic_title FROM forum_posts AS fp LEFT JOIN forum_topics AS ft ON fp.topic_id = ft.topic_id WHERE fp.post_id = '&#34;.$_GET&#91;&#34;post_id&#34;&#93;.&#34;'&#34;;<!--c2--></div><!--ec2--><br /><br />Obviously I have two tables, one called forum_topics and one call forum_posts, and there are some PHP elements, but the workings of the query are not explained in the book from which this example comes.  I understand how everything else works, though, but the author does not explain this query, merely calling it complicated looking...]]></description>
		<pubDate>Sun, 02 Aug 2009 21:30:52 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26475</guid>
	</item>
	<item>
		<title>Variable Not Working In Query</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26464</link>
		<description><![CDATA[Had to erase my whole message as I noticed I left info in that I should not have mentioned. Also, is working now. Many thanks...<br /><br />Son]]></description>
		<pubDate>Sat, 01 Aug 2009 13:20:51 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26464</guid>
	</item>
	<item>
		<title>Update Statement Not Working</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26453</link>
		<description><![CDATA[This might be a stupid question but I don't understand why this isn't working:<br /><br /><!--sql--><div class='sqltop'>SQL</div><div class='sqlmain'><!--sql1--><span style='color:blue;font-weight:bold'>UPDATE</span> &#96;table&#96; SET &#96;title&#96;<span style='color:orange'>=</span><span style='color:red'>"Facebook Connect"</span> && &#96;author&#96;<span style='color:orange'>=</span><span style='color:red'>"1"</span> && &#96;assoc&#96;<span style='color:orange'>=</span><span style='color:red'>'nw'</span> && &#96;assocId&#96;<span style='color:orange'>=</span><span style='color:red'>'8'</span> && &#96;content&#96;<span style='color:orange'>=</span><span style='color:red'>'<span style='color:orange'>&lt;</span>p<span style='color:orange'>&gt;</span>Facebook Connect is cool.<span style='color:orange'>&lt;</span>/p<span style='color:orange'>&gt;</span>&#092;r&#092;n<span style='color:orange'>&lt;</span>p<span style='color:orange'>&gt;</span>It helps you attract more users.<span style='color:orange'>&lt;</span>/p<span style='color:orange'>&gt;</span>'</span> && &#96;tags&#96;<span style='color:orange'>=</span><span style='color:red'>'social networking, facebook'</span> <span style='color:green'>WHERE</span> &#96;id&#96;<span style='color:orange'>=</span>5 <span style='color:green'>LIMIT</span> <span style='color:orange'>1 </span> ; <!--sql2--></div><!--sql3--><br /><br />MySQL doesn't return an error, but nothing updates, except that the title becomes 0.<br /><br />I have tried quoting the &#96;id&#96; value and removing LIMIT 1; but the result is the same. I have tried copying the exact code from phpMyAdmin to my process page but the result is the same, and I also tried executing my code in phpMyAdmin but the same thing happens!<br /><br />At first I thought it was one of my variables that got emptied or something but now I realize that putting text in there doesn't change it.<br /><br /><a href="http://dev.mysql.com/doc/refman/5.1/en/update.html" target="_blank">MySQL gives this syntax for the UPDATE statement:</a><br /><!--sql--><div class='sqltop'>SQL</div><div class='sqlmain'><!--sql1--><span style='color:blue;font-weight:bold'>UPDATE</span> [LOW_PRIORITY] [IGNORE] table_reference SET col_name1<span style='color:orange'>=</span>{expr1|DEFAULT} [, col_name2<span style='color:orange'>=</span>{expr2|DEFAULT}] ... [<span style='color:green'>WHERE</span> where_condition] [<span style='color:green'>ORDER BY</span> ...] [LIMIT row_count] <!--sql2--></div><!--sql3--><br /><br />What am I doing wrong?]]></description>
		<pubDate>Sat, 01 Aug 2009 00:59:30 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26453</guid>
	</item>
	<item>
		<title>Copy Table Row And Paste It With Different Values</title>
		<link>http://w3schools.invisionzone.com/index.php?showtopic=26444</link>
		<description><![CDATA[Hi I have this huge table, i query and get specific row that i like <br /><br />Now i want to copy that row and insert new row in the same table with some modified data<br /><br />How can i do that using PHP<br /><br />Thanks,]]></description>
		<pubDate>Fri, 31 Jul 2009 14:54:59 -0400</pubDate>
		<guid>http://w3schools.invisionzone.com/index.php?showtopic=26444</guid>
	</item>
</channel>
</rss>