Just a curious question but is there any programs that can help/aid you when you write PHP codes? Say there is an error in your code and using this program it would help you locate it, etc.
I might be thinking too much...
I am building a system, mostly for consolidating learning but will be used in practice.
I will try and verbally explain the part of the E-R diagram I am focusing on:
Each cadet can have many uniformID's
Each Uniform ID is a new entry in table uniform, so cadets (table) may look like:
id | name | ... | uniformID
1 | Example | ... | 1,2,3
uniform table:
id | notes | cadet
1 | Need new blahh | 1
2 | Some stuff needed | 1
3 | Whatever you like | 1
On second thought, looks like I wont need that third column in the db.
I am trying to iterate through each id in uniformID, code:
<?php
$cadet = $_GET['id']; // set from URL
$query = mysql_query("SELECT `uniformID` FROM `cadets`
WHERE id = '$cadet' LIMIT 1")
or die(mysql_error()); // get uniform needed as string
// store it
while ($row = mysql_fetch_array($query)) {
$uniformArray = $row['uniformID'];
}
echo $uniformArray . " ";
$exploded = explode(",", $uniformArray); // convert into an array
// for each key in the array perform a new query
foreach ($exploded as $key => $value) {
$query(count($exploded));
$query[$key] = mysql_query("SELECT * FROM `uniform` WHERE `id` = '$value'");
}
?
As I say, this is mainly for consolidation purposes but I have come up with a error, sql is saying:
Fatal error: Function name must be a string in C:\wamp\www\intranet\uniform.php on line 82
line 82 is:
$query[$key] = mysql_query("SELECT * FROM `uniform` WHERE `id` = '$value'");
I wasn't sure it would work so I tried it and now i'm stuck!
EDIT:
Thanks to everyone who has contributed to this! This is now the working code:
foreach ($exploded as $key => $value) {
//$query(count($exploded));
$query = mysql_query("SELECT * FROM `uniform` WHERE `id` = '$value'");
while ($row = mysql_fetch_array($query)) {
echo "<tr>
<td>" . $row['id'] . "</td>
<td>" . $row['note'] . "</td>
</tr>";
}
}
Added the while and did the iteration by nesting it in the foreach
Has anyone here tried it or is it possible?
I've been using PHP for quite a few years but never know exactly the underlying c scripts.
Is there a way to go into it?
When C# app is ran, it POSTS a request to the PHP server, which wants to return an array. What's an easy way to load this array's contents into C# for using with there.
I develop websites using PHP and MySQL. What resources would a seasoned web developer recommend that would cover server-specific information relevant to the job of a developer.
If it helps, I work specifically with an Apache server (through my hosting company).
How to prepare Cyrilic and other variables for storing into MySql DB? (PHP)
So I need realy simple way to prepare recived from browser $_GET[string] variables for storing into DB.
How to do such thing?
Hi everybody,
Having some trouble sending properly formatted HTML e-mail from a PHP script. I am running PHP 5.3.0 and Apache 2.2.11 on Windows XP Professional.
The output looks like this:
Agent Summary for Support on Tuesday April 20 2010=20
Ext. Name Time Volume
137 Agent Name 01:27:25 1
138 =09 00:00:00 0
139 =09 00:00:00 0
You see the =20 and =09 in there? If you look at the HTML you also see = signs being turned into =3D. I figure this is a character encoding issue as I read the following at Wikipedia:
ISO-8859-1 and Windows-1252 confusion
It is very common to mislabel text data with the charset label ISO-8859-1, even though the data is really Windows-1252 encoded. In Windows-1252, codes between 0x80 and 0x9F are used for letters and punctuation, whereas they are control codes in ISO-8859-1. Many web browsers and e-mail clients will interpret ISO-8859-1 control codes as Windows-1252 characters in order to accommodate such mislabeling but it is not standard behaviour and care should be taken to avoid generating these characters in ISO-8859-1 labeled content.
This looks like the problem but I don't know how to fix. My code looks like this:
ob_start();
report_queue_summary($yesterday,$yesterday,$first_extension,$last_extension,$queue);
$body_report = ob_get_contents();
ob_end_clean();
$body_footer = "This is an automatically generated e-mail.";
$message = new Mail_mime();
$html = $body_header.$body_report.$body_footer;
$message->setHTMLBody($html);
$body = $message->get();
$extraheaders = array("From"=>"***redacted***","To"=>$recipient, "Subject"=>"Agent Summary for $yesterday [$queue]", "Content-type"=>"text/html; charset=iso-8859-1");
$headers = $message->headers($extraheaders);
# setup e-mail;
$host = "*********";
$port = "26";
$username = "*****";
$password = "*****";
# Send e-mail
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($recipient, $extraheaders, $body);
if (PEAR::isError($mail)) {
echo("" . $mail->getMessage() . "");
} else {
echo("Message successfully sent!");
}
Is the problem that I'm using output buffering?
Hello
I have a table : tags(tagname,entryid,stamp) and i want to make a section for the most trending tags today, the tagname column has no unique value, because many entries has the same tag, so the php code that i want should display the most attached tags today.
Note: the "stamp" column is the date of adding the tag in UNIX time stamp format.
Thanks
In continuation off of this question, what are the PHP statements I need to accomplish this:
curl -is -F 'J:A-login=BTDT::Action::Login' -F 'J:A:F-address-login=EMAILADDRESS' -F 'J:A:F-password-login=PASSWORD' http://hiveminder.com/splash | grep -o 'JIFTY_SID_HIVEMINDER=[0-9a-f]\+'
The flags and fields are still mysterious, and I've not the time presently to swim through docs to figure out how this translates. I do at least understand the | grep ... portion, though.
I'm interested in this field,but I'm only familiar with PHP so far.
If not,can you recommend a tiny but not so bad project that's easy enough to learn?
I strongly prefer not to use additional 3rd party components, libraries or DLLs (at least in v1.0), unless there is absolutely no other solution.
Question: (how) can I use Delphi to programatically crate a BDE database and write to it, then use PHP to read from it?
Any URLs for examples of tutorial?
Hi,
I'm trying to use PHP to create a file containing a list of phone numbers.
It's working OK however if the phone number begins with zero, the digit is dropped from the excel file.
Does anyone know how to set the formatting correctly so that it remains in place?
Any advice appreciated.
Thanks.
I have a huge repository of files that are ordered by numbered folders. In each folder is a file which starts with a unique number then an unknown string of characters. Given the unique number how can i open or copy this file?
for example:
I have been given the number '7656875' and nothing more.
I need to interact with a file called '\server\7656800\7656875 foobar 2x4'.
how can i achieve this using PHP?
Can anybody please let me know, How open an AES encrypted .zip?. I need an encryption method should be 128-bit or 256-bit AES. As well as this should be a PHP process.
any references...appreciable.
I understand that echo is slightly faster, and print can be used as a function, but I've been reading an e-book on PHP, and the writer is using print, instead of echo, to output very simple text.
print "Your name is $name\n";
So my question is, when would it be appropriate for me to use print as opposed to echo?
I can not assign a xml scripts in to a php variable.
My xml text:
<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0"><channel>
<title>coolajax.net</title>
<link>http://www.hotscripts.com/listings/feed</link>
<description>Coolajax Scripts Listings Description</description>
and I want to assign this text in to $xml_header variable.
can anyone help me..
Say I wanted to print a ÿ (latin small y with diaeresis) from it's Unicode/UTF-8 number of "U+00FF" or hex of "c3 bf". How can I do that in PHP?
Note: In order for it show correctly in a browser I know that the first step is
header('Content-Type: text/html; charset=utf-8');
Ok, I'm looking for the fastest possible way to read all of the contents of a file via php with a filepath on the server, also these files can be huge. So it's very important that it does a READ ONLY to it as fast as possible.
Is reading it line by line faster than reading the entire contents? Though, I remember reading up on this some, that reading the entire contents can produce errors for huge files. Is this true?