logs archiveIRC Archive / Freenode / #php / 2006 / May / 15 / 1
Stormchaser
ha? No.
MarkL
jamey: Uncomment/add extension=sqlite.so in your php.ini file and restart apache
jamey
MarkL, it is uncommented, I checked. phpinfo() returns /etc/php5/apache2/php.ini as the location, which is correct.
MarkL
jamey: Does a <?php phpinfo() ?> page show a sqlite section?
jamey
MarkL, no it doesn't which was my first port of call - "dbx" has SQLite listed in its supported databases but I doubt that's of any help. I'm guessing sqlite.so never gets loaded but it's referenced and exists...
MarkL
jamey: It's worth stopping apache, making sure there's no apache processes still running (kill -9 them is there are), starting apache and also clearing your browser cache just to rule that out as a problem.
Cambridge13
because i use $_POST['Appointments'] which value Appointments suppose to be?? The name of the list box the id or the value?
im confused
ldas
hi
jamey
MarkL, I stopped and started Apache and then did a 'force-reload'. SQLite has popped up in phpinfo() and my script now works! Thank you :-)
         

ldas
if I have a function that prints some string
cand I caputre its output?
Cambridge13
i understood that but if i change them what the $_POST['Appointments'] should be? Is it gonna be the name i give in the list box or the value?
ldas
with ob?
MarkL
Cambridge13: With <select name="foo"><option value="bar" ... $_POST['foo'] would have the value bar
Cambridge13
soz
MarkL
ldas: Yeah
ldas
cool
Cambridge13
so in the $_POST[' '] i put the value of the <select name> not any other value
right?
MarkL
Cambridge13: yeah
Cambridge13
let me try that
MarkL
Cambridge13: If you're ever unsure just do a var_dump($_POST); to see what's in there
softwork_
i insert João to bd, in phpmyadmin i see João
is normal?
Cambridge13
where should i write this var_dump...
?
MarkL
Cambridge13: Usually at the top of the script you post to inside something like, if(!empty($_POST)){ echo '<pre>'; var_dump($_POST); echo '</pre>'; }
symtab
hello
Stormchaser
yes
symtab
to have ssh functions in php, i need to compile php with libssh2 support or is there a way to load the support after php is installed?
MarkL
symtab: http://php.net/ssh tells you how to do it without a recompile
symtab
MarkL: thanks
Cambridge13
Undefined index: Appointments
i dont know why the query does not work.
maybee i need to play around with the quotes
         

MarkL
Do you have <select name="Appointments"> ?
Cambridge13
yes
it always gives me the same error
MarkL
Do the var_dump thing and see what's in there
Cambridge13
is it gonna return the contents in the web page then?
MarkL
It's going to return the contents of the $_POST array, i.e the stuff you submitted
Kernel_burner
Hi guys. Is it possible to make a link in an iframe that refreshes the whole page?
Cambridge13
ok i got them. but i need to figure out what is each one
MarkL
Kernel_burner: Tried using target="_top" ?
Kernel_burner
ok it works. Thanks alot!
MarkL
np
Cambridge13
check this http://hashphp.org/pastebin?pid=6690
uuff it didnt post it .ita gave me a server error
sorry i will post it again
MarkL
Cambridge13: <option value='FreeHours'> .. that inside your loop will give every option the same value
Cambridge13
http://hashphp.org/pastebin?pid=6695 there u go
so how i will print the data of the table? should i only move the <option value='FreeHours'> out of the loop?
MarkL
Cambridge13: Depends, what value would you like to get? The VetName, FreeHour etc? Should be a unique value
symtab
/usr/local/bin/phpize: /tmp/tmpWvImDi/ssh2-0.10/build/shtool: /bin/sh: bad interpreter: Permission denied
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF
any ideas how i can fix this
?
Stormchaser
install autoconf?
Cambridge13
yeah but each value of the list box (each entry) consists of three things: FreeHourID, VetName Day and Time which are taken from one table through an array
MarkL
Cambridge13: You want to know which one they selected, so which field in the db can you use to identify the one they selected?
Stormchaser
!tell Cambridge13 about u
Cambridge13
i guess the FreeHourID
MarkL
Cambridge13: Ah, you need FreeHoursID?
So use, <option value='".$row['FreeHourID']."'>
Cambridge13
outside of the loop??
MarkL
In the loop
Cambridge13
ok let me see
MarkL
That will give each option a unique value
Cambridge13
aha
cjaymes
if a constructor fails to fully create an object what is the Approved Way(tm) of returning that error?
in php 5
MarkL
"An object will always be assigned when creating a new object unless the object has a constructor defined that throws an exception on error."
cjaymes
well, that's simple enough
thanks
Cambridge13
ok now it reads the FreeHourID
but the query does not delete it
ldas
how do I access a variable from outside a class?
is there something like ::$var?
Cambridge13
should i change '" . $_POST['Appointments']."' with '" . $_POST['$row['FreeHourID']."' ??
MarkL
no
Just debug it:
$sql = 'DELETE FROM FreeHours WHERE FreeHoursID =' . $POST['Appointments'];
$delete = mysql_query($sql) or die(mysql_error());
Fushuing
...
that's how i usually write my code :S
Cambridge13
yes i have already debug it. it gives me the error query failed
MarkL
ldas: You probably shouldn't be accessing variables outside the class
Cambridge13: You need to know why it failed, the exact error
ldas
uhm, I'm making a testunit and I need access to db connection vars
Cambridge13
it doesnt say no. Before it ws saying that Appointments was undefined. Now it only gives me the data sent from the $_POST and then the message query failed
MarkL
ldas: Have your db class return an instance and use $db = DB::getInstance(); for example in your class
Cambridge13: That's why i posted the code above, it will tell you exactly why it's failing
ldas
let me see what I can do
thanks, good idea
Cambridge13
it worked
ii had a syntax error
now i dont want the var_dump($_POST); to display the info. is it ok to remove it?
MarkL
Cambridge13: Yeah
Cambridge13
Thank you very much mate. I will continue and if i have another problem i hope i will find you in here
MarkL
np
Cambridge13
is that query correct: $insert = mysql_query("INSERT INTO BookedHours VALUES ('" . $_POST['Appointments']."')")
now i want to insert the posted data (which were deleted from the other table) to another table
MarkL
Cambridge13: No, unless BookedHours only has one column
Cambridge13
Booked Hours is exaclty the same table with FreHours
MarkL
Cambridge13: INSERT INTO BookedHours (columnname) VALUES ('whatever')
Cambridge13
they both have the same fields
MarkL
Cambridge13: But you need to tell it which column you want to put the value in
lig
Morning
ldas
Singleton::getInstance()->dbHost;
it works :D
MarkL
Nice
ldas
thanks again
MarkL
np
steveb
i dont suppose anyone knows of any good frameworks that have support for hierarchical groups in the authentication?
jamey
I'm trying to compile PHP 5.1.4 on Ubuntu but I keep getting this make error: "make: *** [sapi/apache2handler/mod_php5.lo] Error 1". I've installed the apache-dev package which included apxs(2)... how can I fix this error?
guzzlefry
hey everyone
MarkL
jamey: What's the error that comes before that line?
guzzlefry
I'm getting a very strange error, whenever I purposely generate a parse error in my script, the whole script just dies without giving me any error output
lig
guzzlefry: you check your error log?
jamey
MarkL, /home/jamey/php-5.1.4/sapi/apache2handler/mod_php5.c:36: warning: initialization makes integer from pointer without a cast
MarkL
guzzlefry: Check the values of error_reporting and display_errors in your php.ini file
guzzlefry
lig: where would the error log be located?
JJPeerless
whats a good website and/or book to look at to learn php/mysql to build professional websites
lig
guzzlefry: check the php.ini or phpinfo - it should tell you there
jamey
MarkL, maybe this line is relevant? /home/jamey/php-5.1.4/sapi/apache2handler/php_apache.h:29: error: previous decla ration of 'php5_module' was here
MarkL
jamey: Hard to say without seeing the full output of make, maybe post it somewhere?
guzzlefry
error_log has no value, and logging errors is disabled...
lig
guzzlefry: follow MarkL's advice then... check your error_reporting and display_errors
guzzlefry
it is E_ALL ~ E_NOTICE
I just found out that it does report parse errors on a quick little script I wrote, but not on the project I'm currently working on
MarkL
guzzlefry: Check your project doesn't override those ini settings with error_reporting() or php_value settings in a .htaccess file
guzzlefry
I'm sure it doesn't
MarkL
guzzlefry: Change php.ini to use just E_ALL then, that's usually the best option anyway ;)
guzzlefry
but then I get the annoying undeclared variable errors :-(
Cambridge13
Ok i know why the $insert query does not work: First of all the two tables FreeHours and BookedHours have the same fields:FreeHoursID and BookedHoursID respectively (both auto_increment primary keys) VetName, Day and Hour.
When i say delete for FreeHours everything is fine. But when it comes to insert the deleted stuff to the BookedHours table it has to insert the FreeHourID into the field with the BookedHourID which is not able because of the two primary keys conflicting. Am i right?
MarkL
So declare them and have nice code ;)
guzzlefry
what user does PHP run as usually?
MarkL
The web server user, usually apache, httpd or www-data
(sometimes nobody)
guzzlefry
ok, thanks
MarkL
guzzlefry: httpd.conf will tell you
Cambridge13
Because the BookedHourID has to increment but there comes the FreeHourID to get in his place. right?
MarkL
Cambridge13: Sounds like a database design problem. You shouldn't really be deleting from one to then insert it into another, and especially not using the id from one table as the id for another :o
JJPeerless
could someone suggest a good site or book to learn not only the basics of php development but gives you a full instruction on more advanced topics as well?
MarkL
JJPeerless: Book - 'Advanced PHP Programming' is good
lig
(Action) liked that one
JJPeerless
will that also cover basics of PHP..im not new to programming as im a cs major at uni and know c/c++/java very well
just want to learn php
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 next »