This is part of my code:
$con = mysql_connect("localhost","username","passs");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);
if(mysql_num_rows(mysql_query("SELECT name FROM xbox_user WHERE name = '$user'"))){
// Code inside if block if userid is already there
$result = mysql_q...
Ok so I have some gaps in my understanding of PHP OOP, classes and functions specifically, this whole constructor class deal. I use both Zend and CI but right now Im trying to figure this out in CI as it is less complicated.
So all Im trying to do is understand how to call a function from a view page in code igniter. I understand that m...
I'm creating an application that I want to run on either MySQL or SQL Server (not both at the same time) I've created two PHP classes DatabaseMySQL and DatabaseSQLSVR and I'd like my application to know which database class to use based on a constant set up at install.
define(DB_TYPE, "mysql"); // or "sqlsrv"
I'm trying to think of the...
I have the following query:
$this->select()
->where("`name` LIKE ?",'%'.mysql_escape_string($name).'%')
Now I have the Zend_Paginator code:
$paginator = new Zend_Paginator(
// $d is an instance of Zend_Db_Select
new Zend_Paginator_Adapter_DbSelect($d)
);
$paginator->getA...
Hi there.
I am using a ge_called_class hack for allowing late static binding in php version 5.2 (found here).
I have the following in my code:
# db_record.php
$ac = "ForumThread";
$objects = $ac::find("all");
This will not work in php 5.2 for some reason, so I have done this:
# db_record.php
$ac = "ForumThread";
eval("\$objects =...
I'm in the process of writing a small php-cli script that will loop over my personal inbox and then send me an SMS via a gateway.
The question I have is:
As will have the script launch via cron every 10 minutes, if there is an email sitting in my inbox that is not read before the next script launch then I will receive 2 sms.
Does any...
Hi,
I am trying to create quizzes which are kind of like the ones found here : http://theoatmeal.com/quizzes on my drupal site. I am trying to use drupal's quiz module ( http://drupal.org/project/quiz )
Basically everyone answer, in every question, in a quiz will have some particular weightage. Say answer 1 will have 2 marks, ans two w...
Assuming that the mysqli object is already instantiatied (and connected) with the global variable $mysql, here is the code I am trying to work with.
class Listing {
private $mysql;
function getListingInfo($l_id = "", $category = "", $subcategory = "", $username = "", $status = "active") {
$condition = "`status` = '$status'";
...
Need help PHP caching
...
what is gd image and gd2 images? what are the difference between them?
...
I just try to integrate ImageMagick into my PHP project. I installed and just execute the sample files that they provided with the imagick-3.0.0RC1 zip file. But it shows
Fatal error: Class 'Imagick' not found in C:\wamp\www\imagick-3.0.0RC1\imagick-3.0.0RC1\examples\watermark.php on line 9
this kind of an error how can I avoid that. ...
How to install image magic at windows 7. I followed these instruction
To install IMagick on windows xp (php 5.2.x)
1.) download and install ImageMagick-6.5.8-7 Q16-windows-dll.exe
http://www.imagemagick.org/download/binaries/ ImageMagick-6.5.8-7-Q16-windows-dll.exe
2.) download php_imagick_dyn-Q16.dll from:
http://valokuva.org/outside...
User System and Passwords: I was looking through MD5 stuff, and I am wondering what is the normal/good practice for passwords. Right now, I think people super encrypt the passwords and store the hashes. If so, how does password checking work? I just have the input password go through the encryption process again and then check the hash w...
Alright, so I tried to make my users info super secure by adding '" . sha1($_POST['password']) . "' when inserting their password when they register. THAT WORKS great, looking at the database, I have no clue what their password is.
Now the problem is logging in. I'm running some tests and when I try to log in, the password 12345 doesn't...
I have tried every way I can find but the background is always black. Is there any way to keep the transparency of the first image when GD ises it in PHP?
I'm using imagecopymerge to use the image. though i am not sure if this is the right way.
imagecopymerge($dest, $char, 0, 0, 0, 0, 150, 300, 100);
The image is like so: http://file...
To start, I am using PHP with ob_start() and ob_flush.
In the code I have a part where parameters are suppose to be dynmacially loaded in the head of a file.
<head>
<script type="text/javascript" src="javascript/ajax_objects.js"></script>
//Enter More Code Here Later
</head>
What I am trying to is after the compiler has finished an...
Any body know can we use smarty with zend framework. If yes what is the advantage of using like that?
...
How would I go about ensuring that the overridden parent method exists before I call it?
I've tried this:
public function func() {
if (function_exists('parent::func')) {
return parent::func();
}
}
However the function_exists never evaluates to true.
...
I'm working with Colorbox and if I specify to use an iframe with it then the $_SERVER['HTTP_X_REQUESTED_WITH'] variable is no longer available to me. I need that in order to detect if ajax has loaded so then I can include a header/footer or not.
Anyway to get this variable or is there another variable that I can get when I use iframe?
...
Why is it possible to create an interface without specifying a return type? Why doesn't this make this interface unusable?
This makes it more Clear:
Interface run
{
public function getInteger();
}
class MyString implements run
{
public function myNumber()
{
}
public function getInteger()
{
retur...