$sql1 = "SELECT SIDno FROM class WHERE SubjID='$SubjName' and SecID='$SecName'";
$result1 = mysql_query($sql1);
while ($row1 = mysql_fetch_assoc($result1)){
$IDno = $row1["SIDno"];
$sql2="INSERT INTO registered ( ServiceID, IDno, Stype)VALUES('$RecCode','$IDno','$Stype')";
}
this is my code. its working but it only insert one d...
I often use ($var & 1) in my code, which returns true if $var is an odd number and false if it's an even number.
Just dawned on me that I have no idea what "&" actually does. Anyone care to explain?
...
Hi all,
I have troubles using Zend Framework's PDF
When I create PDF file I need to use UTF-8 as encoding.
This is the code I am using to generate simple pdf file.
I always get this wrong displayed.
Instead of seeing 'Faktúra' in pdf file, it gives me 'Faktú'
Instead of seeing 'Dodávateľ:' in pdf file, it gives me 'Dodáva'
$pdf = new...
how can I prevent file_get_contents from creating an empty file when being used as a test condition in an if clause?
An empty file is created regardless, which causes a subsequent call in a different method to getimagesize() to fail.
The problem is, that as I have my code setup, the first time it is called will determine to save an ima...
Folks,
For the n-th time in a row, i'm hitting the same old problem again. It's about "how do I map OOP structures to database tables in a painless way."
Here's a scenario: I have several types of "actors" in my system - workers, employers, contacts. They have certain pieces of functionality in common; other pieces are vastly differen...
Hi, I'm learning PHP and I want to use the mail() function from my localhost. I have WAMP installed and a Gmail account. I know that the SMTP for Gmail is smtp.gmail.com and the port is 465 (more info from gmail).
What I need to configure in WAMP so I can use the mail() function?
Thanks!!
...
i've created an rss feed in php using the below code. i've double checked all the variables (i.e. username and password) and they are correct. mysql is set up correctly as well. i'm just getting a blank page when i try to view this locally on my computer using mamp. any help would be appreciated.. does this code look correct, and is ...
to describe it some more, if i have an image map of a region that when clicked, a query is performed to get more information about that region.my client wants me to display an approximate number of search results while hovering over that region image map.my problem is how do i cache? or get that number without heavily exhausting my serve...
Hi,
I am using SVN to manage a copy of my web site. The site runs a typo3 installation, which uses PHP to create the backend.
The problem is, all the stupid .SVN folders show up in the directory listing of PHP. I DO NOT mean the build in apache listing. I mean a directoy listing created by the PHP backend.
So, is there any way to hide ...
what is the purpose of interface when writing a class?
heres an example i've seen online.
<?php
interface Chargeable {
public function getPrice();
}
class Employee implements Chargeable {
protected $price;
public function getPrice() {
return $this->price;
}
}
$product = new Employee();
?>
...
I have a script that will output a jpg, gif or png image. It uses the appropriate content-type according to the extension of the file (which in this case will be the right one always).
The problem is, I have a small number of files which will cause a 500 internal server error when I try to access them this way. However they work if I tr...
I'm trying to do an INSERT into a mysql db and it fails when any of the values are longer than 898 characters. Is there somewhere to get or, better, set this maximum value? I'll hack the string into chunks and store 'em in separate rows if I must, but I'd like to be able to insert up to 2k at a time.
I'm guessing this is php issue as us...
I am building a POP3 mailbox in PHP.
I have the following files:
server_access.php (fetch mails from the POP3 server)
data_access.php (which fetches/writes mails to local DB)
mime_parser.php (parses MIME content)
core.php (uses above files and stores parsed mail as an assoc array called $inbox)
Now, I have the pages mailbox.php to sh...
Recently, I took it upon myself to try and learn OO programming. It has been about 3 months since I started, but I think I might be missing the point because I seem to prefer static methods (which seem 'easier' to me).
Example
Here is what a typical DB query looks like in my code.
$bindings = array(':name'=>$articleName);
Db::query('...
Here's my situation: I'm building a small website where, when registring, you can select which days you're available for something.
Mondaymorning
Mondayafternoon
Tuesdaymorning
Tuesdayafternoon
etc...
All the way to sundayafternoon.
I'm formchecking this offcourse, in PHP, and I need to declare 14 variables and go over each one to det...
I have a Problem with PHP and SVN. See here...
Using FUSE would be one option, but after a first look, it seems very complicated.
Is there any option to prevent an NTFS filesystem, WIN2003Server, to hide directories completely from a useraccount (I can setup apache to run under this account).
It is not as easy as it seems, given the f...
I have a php script that checks for updates on many (thousands) of sites.
On occasion (more frequently as the number of sites increases), I get an execution timeout on the update of one of these sites, and the whole script goes down the drain.
The best idea I could come up with is to fork each update, so if it dies, the overall update j...
Does anyone know of a tool to analyze php error logs? I have a bunch of error logs from a number of different servers. I'd like to get the most frequent errors broken down by severity (fatal, warning, etc.), scripts that generate the most errors, etc.
I could write some shell scripts to do this, but if there are any decent tools already...
I,m using two tables (regions and safaris) having many to many relationship. the tables are joined by another table called regions_safaris (with the fields - region_id $ safari-id). I want to fetch all safaris meeting a given criteria like durations of 5 days and in a given region.
This should be implemented in cakephp
...
I have the following code:
$countQuery = "SELECT ARTICLE_NO FROM ? WHERE upper(ARTICLE_NAME) LIKE '% ? %'";
if ($numRecords = $con->prepare($countQuery)) {
$numRecords->bind_param("ss", $table, $brand);
$numRecords->execute();
$data = $con->query($countQuery) or die(print_r($con->error));
$rowcount = mysql_num_rows($data...