XAMPP site have anything to say about it?
Alas no.
I have done a lot of searching via google, but nothing has fixed the issue
XAMPP site have anything to say about it?
Alas no.
I have done a lot of searching via google, but nothing has fixed the issue
Hi all,
I am in need of assistance.
I am trying to configure PEAR with XAMPP 1.8.0 on Win 7 64Bit.
I download the go-pear.phar (http://pear.php.net/manual/en/installation.getting.php) and ran the instructions.
Updated my env path. All looked ok.
Tried to run pear help
and i get nothing, no error, not a snip.
Uninstalled XAMPP, ran CCleaner, rebooted, removed and env path that was changed. Rebooted.
Reinstalled XAMPP, rebooted (see where this is going?), redownloaded go-pear.phar.
Reran it, rebooted, re ran pear help
still nothing
I have tried this in different combinations, and cannot for the life of me see what i am doing wrong.
I have had PEAR configured and working before, i had to rebuild my OS so i lost it a while back.
Can anyone help out?
Marty i run Win 7, but opted for XAMPP over IIS, less confirguration for intial setup
But it still isn't saving the question. Any ideas what I may be doing wrong. Any help would be appreciated.
Are you getting an error?
Have you dumped the POST data to make sure this is populated as you expect?
Have you tested your SQL strings?
Are you getting an error?
Have you tried it without the mysql connection?
if($row['banned'] == '1') {
header( 'http://www.awsomechat.comuv.com/ban/userbanned.php' );
} elseif ($row['banned'] == '2'){
header( 'http://www.awsomechat.comuv.com/ban/userbanned.php' );
}
Should these not read
header('location : http://www.awsomechat.comuv.com/ban/userbanned.php' );
&& ( :) )
header('location : http://www.awsomechat.comuv.com/ban/userbanned.php' );
It certainly is possible. You would put your host details instead of LOCALHOST.
Unless you are setting up a secure connection i would export your db from the host, and import it locally.
That way you remove any risk
Ok, so i appricate this is solved, but i though i would follow up:
compact small autoload snippet:
spl_autoload_extensions(".php");
spl_autoload_register();
However this will only function if your namespace follows a directory structure. I came across this on DreaminCode as i was looking for a very simple __autoload
Here is both the files, with the folder they are in in the head:
load_headScript.php:
<?php
// root: -> /classLib/load/load_headScript.php :
spl_autoload_extensions(".php");
spl_autoload_register();
use classLib\database\database_Connection as DB; // import namespace for code reuse
class load_headScript
{
public function headLoad()
{
$sql = "SELECT scriptCode FROM head_scripts WHERE active != '0'";
$stmt = DB::get()->prepare($sql);
$stmt->execute();
$stmt->setFetchMode(PDO::FETCH_ASSOC);
while($row = $stmt->fetch())
{
print "<script type='text/javascript'>";
print $row['scriptCode'];
print "</script>";
}
}
}
?>
database_Connection.php
<?php
// root -> /classLib/dataBase/database_Connection.php:
namespace classLib\database; // declare namespcae
class database_Connection {
/**
* @var PDO The database link.
*/
protected static $dbLink;
/**
* Returns an open PDO object. This object will be shared
* among all who call this method, so that you don't have
* to be creating multiple connections to MySQL in the
* same request.
* @return PDO
*/
public static function get()
{
if(self::$dbLink == null)
{
$dns = 'mysql:host=localhost;dbname=roundth4_rtb2';
self::$dbLink = new \PDO($dns, 'root', '');
self::$dbLink->exec("SET NAMES 'utf8'");
self::$dbLink->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
}
return self::$dbLink;
}
/*
* We don't want this class to be able to spawn objects.
* By making these two methods private, we effectively
* prevent that from happening.
*/
private function __construct() {
return false;
}
private function __clone() { …
they have different precedence.
True. &&
is before and
- ||
is before or
:)
I thought session_start()
had to be the first line before any output?
**Note:
To use cookie-based sessions, session_start() must be called before outputing anything to the browser. **
i have started using Netbeans. Very nice and easy to use. Best of all its free!!
I have also used Dreamweaver CS5.5 and 6
i would suggest sanitising the data before doing anything, be it before the class, or passing the data to a function with in the class
@Atli
You have been a great help.
All though you say an __autoloader would be overkill, it would be handy to know how to use, so i think i will look into that one also.
@Atli
Thank you, still had that line commented out :)
Although i had to remove self::$dbLink->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
as this was throwing:
Fatal error: Class 'organization\projectname\database\PDO' not found in G:\xampp_server\htdocs\classDrv_rtb\class\scripts\dbconnection.php on line 31
Tried the above and it kicks out this error
Fatal error: Class 'organization\projectname\database\Database' not found in G:\xampp_server\htdocs\classDrv_rtb\class\scripts\headScripts.php on line 17
This is the code of the script:
<?php
use organization\projectname\database\Database as DB;
#require("dbCon.php");
class headScript
{
public function headLoad()
{
/*$cxn = new dbConnection;
$cxn = $cxn->pdo();
$stmt = $cxn->prepare("SELECT scriptCode FROM head_scripts WHERE active != '0'");*/
$sql = "SELECT scriptCode FROM head_scripts WHERE active != '0'";
$stmt = DB::get()->prepare($sql);
$stmt->execute();
$stmt->setFetchMode(PDO::FETCH_ASSOC);
while($row = $stmt->fetch())
{
print "<script type='text/javascript'>";
print $row['scriptCode'];
print "</script>";
}
}
}
?>
Thank you both for your suggestions. I will try this when i amhome and post back:-)
Ok, following from my previous thread (now resolved) i want to convert and use namespace.
headScript.php:
<?php
class headScript
{
public function connection()
{
try
{
$dbh = new PDO("mysql:host=localhost;dbname=roundth4_rtb2", 'root', ''); // Dev
return $dbh;
}
catch(PDOException $e)
{
echo "Error :- " . $e->getMessage();
die();
}
}
public function headLoad()
{
$cxn = $this->connection()->prepare("SELECT scriptCode FROM head_scripts WHERE active != '0'");
$cxn->execute();
$cxn->setFetchMode(PDO::FETCH_ASSOC);
while($row = $cxn->fetch())
{
print "<script>";
print $row['scriptCode'];
print "</script>";
}
}
}
?>
I'd like to remove the connection function and put this in its own file, then using namespace to pull this in. That way i have one file which can be called via namespace and i can use this function.
Am I thinking this is possible when it is not?
I have tried a few things but cant seem to get it to work.
Can anyone offer assistance?
Every programmer should know the difference between Google and Forums... -__-
+10 :)
If yoyu are starting, i would suggest not jumping feet first in to an "advanced website".
For tutorials, google is your friend:Click Here
Have you tried to count the actual records that the query returns as I suggested in my next post? Or have you tried to test the query in phpmyadmin?
:) i had a darn typo in my table name!!! @broj1 thanks for your assistance.
@broj1,
Sorry was a typo :(
It is as you have put where active != 0
in my script.
Just cant figure out why it is not showing the damn thing
Hi all,
Hoping you can assist. I am probably starring at the darn thing but i cannot see the wood through the trees :)
class headScript
{
public function connection()
{
try
{
$dbh = new PDO("mysql:host=localhost;dbname=xxx", 'xxx', 'xxx'); // Dev
return $dbh;
}
catch(PDOException $e)
{
echo "Error :- " . $e->getMessage();
die();
}
}
public function headLoad()
{
$cxn = $this->connection()->prepare("SELECT scriptCode FROM head_scrips WHERE active = '0'");
$cxn->execute();
$cxn->setFetchMode(PDO::FETCH_ASSOC);
print "<script>";
while($row = $cxn->fetch())
{
print $row['scriptCode'];
}
print "</script>";
}
}
I have this basic class, it will get all active scripts from the database.
I am using this to relay hte data to the page head:
$scriptOut = new headScript;
print $scriptOut->headLoad();
I am getting the <script>
tags rendered but no script
Can you assist?
Hey Mods.
I have changed my avatar 2~3 days ago.
But my old one is still posting when i do things. Why?
'$school_id'"),0, 'logs_id'));
Should this not be 1
?
This should help:
RewriteEngine On
RewriteRule ^([^/]*)$ /pages/fetchpage.php?id=$1 [L]
@LastMitch
I am sooooooooooooooo dizzy :)
Copy and paste your backed up schema in to :
[XAMPP_DIR]\mysql\data
Did you backup your data folder before installing XAMPP, as you have stated you had MySQL installed previous before XAMPP.
http://www.daniweb.com/web-development/php/threads/431015/phptriad
There lays your issue. Take a backup of your data
folder.
Remove MySQL, and XAMPP (assuming you installed XAMPP). Reboot or use [CCLEANER], reinstall.
(CCleaner is ideal for not having to reboot after uninstalling stuff like this)
You need to use your imagination.
You have clearly stated
actually it is a project work which is to be represented in college.
glad i could help
If its solved, mark it so :)
Trees
Cars
Computers past-> present
Screws
Birds? where they are, what different types with images and search function, with migratory patterns
Really?
Thats is your own thing
i am totaly confused.
Which part are you confised about?
i changed that to "false" and now when i try to login using "root" and "1234" i get the error
Change it back
The ITW file type is primarily associated with 'Icetips Wizard Editor'. (partially encrypted ini file)
Looks like you need a HEXIDECIMAL viewer
that's why im confuse why it is not running
The only thing i can think of is actually running the install on your webhost
Did you have MySQL installed prior to installing this?
I do not beleive you can use mysql_real_escape_string within a SQL statement.
This should be done via to the INSERT
statement
$stmt = $pdo->prepare("SELECT * FROM $tbl_name where id= :id AND cls= :cls ORDER BY id DESC");
This is a select statement not an insert. So you would not need the id= :id
$stmt = $pdo->prepare("SELECT * FROM $tbl_name where cls= :cls ORDER BY cls DESC");
$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT);
This would need to be changed as you are using POST data
$stmt->bindParam(':cls', $_POST['cls']);
how are you defining the :cls variable?
Is this from $_POST, $_GET data?
Else I do not understand how you expect to use it in your SQL stmt?
Where is the :cls
coming from? is this in the url also?
Thanks for that squidge, I will take a look at that. Hopefully it won't take much.
No problem squeak24
The :id
is a placer. Using this is more secure, and allows you to clean the data. Because you are GETting data from the URL this could have been altered or used for SQL injection.
So we use a place holder.
You can use the same for name and cls, although this
$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT);
is specific to getting the data from the URL
<?php
// Using PDO
$tbl_name = "forum_question";
$pdo = new PDO('mysql:dbname=test;host=localhost', '', ''); // first '' is user, second '' is password
$stmt = $pdo->prepare("SELECT * FROM $tbl_name where id= :id ORDER BY id DESC");
$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT);
$stmt->execute();
$stmt->setFetchMode(PDO::FETCH_ASSOC);
?>
Your above SQL using PDO, you would then step through the data or display it with something like:
while($row = $stmt->fetch())
{
echo $row['TABLE_COLUMN_1'] . " " . $row['TABLE_COLUMN_2'];
}
'
$stmt->bindParam(':id', $_GET['id'], PDO::PARAM_INT);
This sanitises the int PDO::PARAM_INT
.
This is order by the id
ORDER BY id
So to do the same using name
and class
you should be able to do this.