siric
-
Posts
116 -
Joined
-
Last visited
Posts posted by siric
-
-
You can use the MySQL function Format to add the comma's before displaying. If you want the user to input the value as a string with commas in it simply strip them out by str_replacing ',' with ''. That's assuming mysql won't accept an Integer with them in (which I don't think it will, but I've not tested it).
This is the way to go. Integer will not allow commas (it strips anything after).
-
What is the data type on the price? If it is text or varchar, you will get that problem. Make sure that it is set to integer or float.
-
What you need to do print the variables all the way along the script and follow along manually.
This should help you find where the problem variable is.
-
$logged_string = "$_SERVER[REMOTE_ADDR] |" . date("j M Y g:i a")." \n\r" ; $file = fopen("userIP.log", "a"); fputs($file, $logged_string, strlen($logged_string)); fclose($file);
-
As a debug, I would print the $query statement to a logfile and check it when the problem occurs.
-
You need to run a select for each year and order the results
Say you had a table named TABLE with columns DATE and VALUE.
$sqlYear = "SELECT DISTINCT YEAR(datepro) AS YEAR FROM factory_output ORDER BY YEAR DESC;"; //This will select all unique instances of the year from the date field and sort them in descending order $resYear = mysql_query($sqlYear); $numYear = mysql_num_rows($resYear); for ($i = 0; $i < $numYear; $i++) { $year = mysql_result($resYear,$i,'year'); $sqlValue = "select VALUE from TABLE where year = '$year' order by VALUE"; $resValue = mysql_query($sqlValue); $numValue = mysql_num_rows($resValue); echo "$year <br />; echo "--------- <br />; for ($j=0; $j < $numValue ;j++) { //Rotates through each instance of the value for that year $value = mysql_result($res,$j,'value'); echo "$value <br />; } echo "<br />"; }
Wrote this on the fly, so give this a wing and let us know.
-
my bad, try this:
<?php echo '<input type="radio" value="1" name="quality"'.(($var1 == '1') ? ' checked' : '').'" />'; ?>
i had given you the wrong comparable (= instead of ==) .. try this code now.
EDIT: for the record, i rarely test code that i post.
That was the problem. I started from an if statement from scratch and realised just before I saw this post.
Much Thanks.
-
<?php echo '<input type="radio" value="1" name="quality"'.(($var1 = '1') ? ' checked' : '').'" />'; ?>
and so on for each $var;
Thanks. Will try this.
Have tried it and it doe snot work. Button is always unchecked.
-
<?php echo '<input type="radio" value="1" name="quality"'.(($var1 = '1') ? ' checked' : '').'" />'; ?>
and so on for each $var;
Thanks. Will try this.
-
Hi,
I am pulling data from a database to populate a form for editing purposes. The form includes many radio buttons.
Is there a more elegant way to accomplish this than the following -
if ($var1 = '1') { print "<input type='radio' value='1' checked name='quality'>1<p>; } else { print "<input type='radio' value='1' name='quality'>1<p>; } if ($var1 = '2') { print "<input type='radio' value='2' checked name='quality'>2<p>; } else { print "<input type='radio' value='2' name='quality'>2<p>; } ......
Thanks
-
[!--quoteo(post=363665:date=Apr 11 2006, 02:20 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ Apr 11 2006, 02:20 PM) [snapback]363665[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Firtly, the Msxml2.ServerXMLHTTP object is not a native asp object, but an extension. It looks like most of this functionality would be available in php's [a href=\"http://php.net/curl\" target=\"_blank\"]curl[/a] extension though.
Server.Createobject = curl_init()
oXmlHttp.setRequestHeader = curl_setopt()
oXmlHttp.send = curl_exec()
Response.Write = echo()
[/quote]
Thanks for the info. -
Hi,
I have a short script that I need to convert from ASP to PHP. It basically pushs headers and variables through a URL from a form.
[code]
' Assign values to variables
strURL = "http://192.168.254.1:7000/"
varRecipient = Request("frmPhone") & ":1:1"
varSubject = Request("frmSubject")
varMessage = Request("frmMessage")
varContentLength = Len(varSubject) + Len(varMessage)
Set oXmlHttp = Server.Createobject("Msxml2.ServerXMLHTTP")
oXmlHttp.open "POST", strURL, False
Call oXmlHttp.setRequestHeader("Host","Host")
Call oXmlHttp.setRequestHeader("X-Service","service")
Call oXmlHttp.setRequestHeader("X-Password","password")
Call oXmlHttp.setRequestHeader("X-Sender","sender")
Call oXmlHttp.setRequestHeader("X-Recipient",varRecipient)
Call oXmlHttp.setRequestHeader("Content-Length",varContentLength)
oXmlHttp.send(varSubject & varMessage)
If (oXmlHttp.status <> 200) Then
' If not successful display error response text and code
strReturn = oXmlHttp.responseText
Response.Write(strReturn & "<br>")
Response.Write(oXmlHttp.status & "<br>")
Response.Write(oXmlHttp.readyState & "<br><br>")
Response.Write("Error!! <br><br>")
Else
' Else display sms sent
Response.Write("<b>All Ok!</b> <br><br> Recipient(s): " & Request("frmPhone") & "<br> Subject: " & varSubject & "<br> Message: " & varMessage & "<br><br>")
End If
[/code]
So I am trying find the equivalent of
Server.Createobject,
oXmlHttp.setRequestHeader,
oXmlHttp.send,
Response.Write
It is possible? My research is pointing me in the direction of AJAX. Is that the only option?
Thanks
Steve
Help needed with form code for MySQL database on GoDaddy
in PHP Coding Help
Posted
Your script shows the database name as "vixtay.db", yet the GoDaddy information shows the name as "vixtayDatabase".