|
Well you should try to find out if the query actually returns something. Try this
<br />
$dbResID = mysql_query ( $make, $access);<br />
if(mysql_errno($access)>0)die("the following sql: $make<br /> produced an error:<br />".mysql_error($access)."<br />");<br />
If there is no error there check to see how many rows have been selected:
echo"<p> selected rows:".mysql_num_rows($dbResID)."</p>";
And let us not forget the most important part, the html output(if you did not check it by now) there is something missing. The select tag
<br />
echo'<select name="cars">';<br />
while ( $row = mysql_fetch_row($dbResID) )<br />
print "<option value=\"$row[0]\">$row[1]</option>\n";<br />
echo'</select>';<br />
That is all the debugging that can be done, and if nothing up there works, then there is something really wrong somewhere else.
Hope this helps.
P.S. Sorry about the fact that part of the code is not displayed right, but I did insert the code tags while writing.
It can't rain all the time
|
|
|
|
|
hello my friends.
i want to find max and min value in a text file in php plz help me this file is like this.
<pre lang="msil">
for example i want to find:899129917:19.5 &amp; 899129911:7
899129901:17
899129902:12
899129903:19
899129904:8
899129905:9.5
899129906:11
899129907:13.5
899129908:17
899129909:17.5
899129910:16
899129911:7
899129912:12
899129913:7.5
899129914:9
899129915:15
899129916:15
899129917:19.5
899129918:18.5
899129919:11
899129920:10</pre>
|
|
|
|
|
So, what have you tried? Is there a problem reading, parsing and comparing the values to get the max and min?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
assign the values to an array and use one of the array sort functions, then just get the first and last values. I did not test this but is should work fine.
|
|
|
|
|
Here is the algorithm in pseudo-code, it's up to you to implement it in PHP:
min=-99999;
max=+99999;
minLine="";
maxLine="";
foreach(line in file) {
split the line by its colon
convert the second part to a number, and store in val
if (val < min) { min=val; minLine=line;}
if (val > max) { max=val; maxLine=line;}
}
As you can see, we don't use arrays nor sort algorithms, just process data as you get it.
|
|
|
|
|
I would try the third parameter here[^].
|
|
|
|
|
Okay, so the code would be something like this?
header("Location: error.php", 404);
modified 21-Dec-20 21:02pm.
|
|
|
|
|
1.
I don't know, all I did was read the one page of documentation.
2.
Probably not, it is the third parameter, not the second, that looks interesting.
|
|
|
|
|
Yeah I guess you're right, because it didn't work.
modified 21-Dec-20 21:02pm.
|
|
|
|
|
Apparently, when you call header() for the current status code, then call header() again for the status code you want to change it to, it will change:
header("HTTP/1.1 200 OK");
header("HTTP/1.1 404 Not Found");
The title of the page does change then, but error.php doesn't load. When a redirect is added to redirect the user to error.php, the status code set is overridden by HTTP/1.1 302 Found. I'm stumped.
modified 21-Dec-20 21:02pm.
|
|
|
|
|
Hi all,
This is my first post so go easy with me.
I doubt anyone's familiar with RightNow CRM, but it's this application's database I'm manipulating with the use of SOAP. RightNow is a Customer Relationship Management application and is basically a large database which allows people to store information of any kind relating to pretty much anything they want.
This application provides functionality called Custom Objects. Custom Objects allow people to build specific functionality within RightNow and make it available to users. For example, a custom object 'Computer' might be created and information such as its manufacturer, specification and price may be stored. Think of them much as objects in OOP.
I am currently trying to create (or instantiate) an Accreditation object that I have built in RightNow using WSDL. I'm using a tool called
WSDL2PHP which has generated a set of classes and functions from the WSDL file, which I've been using to perform operations progammatically in RightNow.
My problem lies with the SOAP that is being generated. Specifically, an element 'DataValue', which is supposed to contain a child element 'StringValue', is continually being output as '<ns1:datavalue>' with no child. The WSDL file describes DataValue thus:
<xs:element name="DataValue" type="DataValue"/>
<xs:complexType name="DataValue">
<xs:choice minOccurs="1" maxOccurs="1">
<xs:element name="Base64BinaryValue" type="xs:base64Binary" minOccurs="1" maxOccurs="1"/>
<xs:element name="BooleanValue" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
<xs:element name="BooleanValueList" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="DateTimeValue" type="xs:dateTime" minOccurs="1" maxOccurs="1"/>
<xs:element name="DateTimeValueList" type="xs:dateTime" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="DateValue" type="xs:date" minOccurs="1" maxOccurs="1"/>
<xs:element name="DateValueList" type="xs:date" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="DecimalValue" type="xs:double" minOccurs="1" maxOccurs="1"/>
<xs:element name="DecimalValueList" type="xs:double" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="IDValue" type="rnb_v1:ID" minOccurs="1" maxOccurs="1"/>
<xs:element name="IDValueList" type="rnb_v1:ID" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="IntegerValue" type="xs:int" minOccurs="1" maxOccurs="1"/>
<xs:element name="IntegerValueList" type="xs:int" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="LongValue" type="xs:long" minOccurs="1" maxOccurs="1"/>
<xs:element name="LongValueList" type="xs:long" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="NamedIDDeltaValueList" type="rnb_v1:NamedIDDelta" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="NamedIDHierarchyValue" type="rnb_v1:NamedIDHierarchy" minOccurs="1" maxOccurs="1"/>
<xs:element name="NamedIDHierarchyValueList" type="rnb_v1:NamedIDHierarchy" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="NamedIDValue" type="rnb_v1:NamedID" minOccurs="1" maxOccurs="1"/>
<xs:element name="NamedIDValueList" type="rnb_v1:NamedID" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ObjectValue" type="GenericObject" minOccurs="1" maxOccurs="1"/>
<xs:element name="ObjectValueList" type="GenericObject" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="StringValue" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="StringValueList" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:complexType>
The code that WSDL2PHP has generated for DataValue is thus:
class DataValue {
public $Base64BinaryValue; // base64Binary
public $BooleanValue; // boolean
public $BooleanValueList; // boolean
public $DateTimeValue; // dateTime
public $DateTimeValueList; // dateTime
public $DateValue; // date
public $DateValueList; // date
public $DecimalValue; // double
public $DecimalValueList; // double
public $IDValue; // ID
public $IDValueList; // ID
public $IntegerValue; // int
public $IntegerValueList; // int
public $LongValue; // long
public $LongValueList; // long
public $NamedIDDeltaValueList; // NamedIDDelta
public $NamedIDHierarchyValue; // NamedIDHierarchy
public $NamedIDHierarchyValueList; // NamedIDHierarchy
public $NamedIDValue; // NamedID
public $NamedIDValueList; // NamedID
public $ObjectValue; // GenericObject
public $ObjectValueList; // GenericObject
public $StringValue; // string
public $StringValueList; // string
}
The code that I have used to set a StringValue for DataValue is thus:
$dataValue = new DataValue();
$dataValue->StringValue = 'TEST';
However, the DataValue element is always being output, as previously mentioned, like this in the SOAP: <ns1:datavalue>. Would anyone be able to put forward a reason as to why this is happening? As far as I can see the classes that WSDL2PHP has generated are correct and I have not had the same trouble when using other complexTypes.
Many thanks,
Chris.
|
|
|
|
|
I'm currently working on a Calendar for our companies intranet site. I've got the basic functionality of the calendar working but I'm running into a problem when I want to change months. I've gotten this to work fine in ASP but trying to do this in PHP has me stumped. All I'm trying to do right now is a basic "next month", "previous month". Everything I've tried just reloads the page and nothing changes as I'm sure I'm losing my variable values in the process. I guess what I'm asking is how can I just update the table that I have to display the Calendar and not the whole page?
|
|
|
|
|
<?php
echo "<pre>";
print_r($_POST);
echo "</pre>";
?>
Place the above in your target page to find out what is being passed to it.
|
|
|
|
|
First off I haven't done anything PHP in about 8 years so please bear with me. I'm currently changing over my work from ASP to PHP as we are now running a Linux Server. What I'd like to do is be able to shorten up my "work" by using functions (I think that is the correct term) but I'm not sure if I can do what I want.
What I would like to do is put something similar into a function so I can obviously change some of the parameters based on the department for a phone list. I figured I'd start off easy so chose this page first.
echo tr td colspan=4 Portland Collection Department /td /tr;
echo tr td Name /td td ext /td td eMail /td td Position /td /tr>;
$result = mysql_query("SELECT name, extension, email, position FROM employee where department = 'Collection Department'");
$cnt=0;
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
row_color($cnt++,"9966CC","FFFFFF");
echo td>.$row{'name'}."/td>";
echo "td>".$row{'extension'}."/td>";
echo "td>".$row{'email'}."/td>";
echo "td>".$row{'position'}."/td>/tr>";
}
I'm going to probably change some of the layout but if I can get the basics down again it'll give me a good place to start. Thank you in advance for your help.
|
|
|
|
|
I'm not sure you code was displayed correctly or not but it looks close to how I would do it.
<?php
$dbh = mysql_connect("","","");
mysql_select_db("");
$sql = "select name, phone1 from contacts";
$rst - mysql_query($sql) or die(mysql(error());
if(mysql_num_rows($rst)>0)
{
$i=0;
echo "<table class='contact_list'>\n";
echo "<tr><th>NAME</th><th>PHONE #</th></tr>\n";
while($row = mysql_fetch_assoc($rst))
{
$bgcolor = "#fff;";
if($i%2) $bgcolor = "#ddf;";
echo "<tr style='background-color:".$bgcolor."'><td>".$row['name']."</td><td>".$row['phone1']."</td></tr>";
}
echo "</table>\n";
}
else
{
echo "<p class='notice'>No records founds.</p>\n";
}
?>
modified on Wednesday, December 8, 2010 4:06 PM
|
|
|
|
|
The code wasn't displayed properly, for some reason it kept trying to parse it even though I had it in the code block, not sure what I did wrong there.
Anyways, I got it to work (kinda) on my own during the day. However the problem I'm running into (if it is a problem) is that I'm not able to get more than one "include" to work. Am I limited to one or am I doing it wrong. I was trying something like the following:
<?php
include('config.php');
include('format.php');
basic("Portland","Collection");
?>
just an example as I can't remember what it was off had as it's at work but config has the database info in it and the format has basically what I posted above (i.e. the table layouts). Also to get it to work I had to put everything in config.php
just a side note, the above code droped the <`?php (minus the ` in it) (still not sure what I'm doing wrong there...
|
|
|
|
|
To get the code to display correctly in this forum i do a copy and past of the info between the pre tags. The forum will automatically convert some tags into urlencoded version for proper display.
With the include issue it sound like you are having a failure in one of the includes and it is not being reported, displayed in the browser. That maybe be due to the php.ini settings regarding error reporting. On particular odd errors I can sometimes run a script from the command line and I will see some hidden errors displayed. Otherwise I will use an echo string to narrow my debug search...also keep an eye on page and function name capitalization because on linux it is very strict. IE: format.php is not the same as Format.php. Windows is more relaxed on this issue.
edit - just remembered Linux may want a full path too.
Hope I'm helping ya.
Chris J.
|
|
|
|
|
I'll try using the full path and see if that helps.
|
|
|
|
|
Hello,
I am using a div tag in a page called profiles.php whos left content is being brought in by using require_once...
<div class="divMain_Left">
<?php require_once('left.php'); ?>
</div>
whilst this works fine and I have links in the page left.php that is being fed in to the div, I would like when any of these links are clicked to have it open in the same div tag? I have tried the target options but none of them seem to open within the div tag and they just open a new page.
If anybody could point me in the right direction please.
Many thanks in advance
Regards
Ray
|
|
|
|
|
Thats how links work, to just have the divs contents refreshed and not the page you have 2 options I can think of.
1) use an frame or iframe.
2) use ajax.
Of the two, ajax, is I think the better option.
|
|
|
|
|
What you're trying to do can't be done by inlining the included content with include() or require().
The content that you wish to include will require an additional request to the server for the new content and this will need to be rendered to be browser either using AJAX or an iframe. AJAX would be generally accepted to be the best practice in this case.
This is somewhat advanced stuff, but the jQuery library would make this relatively easy. You would assign a function to the onclick event of the link that would "get" the content from the content URL.
For more information, see:
http://www.w3schools.com/htmldom/default.asp[^]
http://api.jquery.com/jQuery.get/[^]
|
|
|
|
|
I want to make a binary tree structure for my multi level marketing website but not able to get it.
It could be great if someone could link me to a good tutorial or if someone can help me through this.
|
|
|
|
|
I'm not sure what you want exactly, but take a look at these:
PHP Binary Tree[^]
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Thanks bro that link helped me alot
|
|
|
|
|
All,
I working on PHP with Zend Framework. I could not able to debug my application.
I am getting the exception as below,
An error occurred
Page not found
Exception information:
Message: Action "indexPhp" does not exist and was not trapped in __call()
Stack trace:
#0 /var/www/html/sample/library/Zend/Controller/Action.php(515): Zend_Controller_Action->__call('indexPhpAction', Array)
#1 /var/www/html/sample/library/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('indexPhpAction')
#2 /var/www/html/sample/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#3 /var/www/html/sample/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#4 /var/www/html/sample/application/Bootstrap.php(11): Zend_Application_Bootstrap_Bootstrap->run()
#5 /var/www/html/sample/library/Zend/Application.php(366): Bootstrap->run()
#6 /var/www/html/sample/public/index.php(12): Zend_Application->run()
#7 {main}
Request Parameters:
array (
'controller' => 'public',
'action' => 'index.php',
'module' => 'default',
)
How to fix this issue?. Any idea please..
Regards,
Periyasamy.R
|
|
|
|