You code looks okay, so check that you have session_start();
's on all pages and that $row['uid']
value is actually being set.
Sessions are needed to maintain security, thats for sure.
You code looks okay, so check that you have session_start();
's on all pages and that $row['uid']
value is actually being set.
Sessions are needed to maintain security, thats for sure.
Yes you should.
Then just something like: <img src="<?= $photo['url']" ?>
session_start();
at the top of your page. You can't set/use $_SESSION
variables without that function being called.
So you need a PHP file that it's going to send to, if the 'delete' submit button has been clicked, and use the checkboxes as an array:
<input name="checkbox[]" type="checkbox" value="<? echo /* row id */ ?>">
<input type="submit" name="Delete">
if(isset($_POST['Delete']))
{
$deleted_id = $_POST['checkbox'];
$num = count($deleted_id);
if (count($num) > 0)
{
foreach ($deleted_id as $id)
{
$sql = "DELETE FROM `db_name` WHERE id='$id'";
$res = mysql_query($sql) or die(mysql_error());
}
}
if($res)
{
echo $num." Records deleted Successfully.";
}
}
?>
You should be okay to tweak these snippets to get then working with your code.
http://www.w3schools.com/ are probably the best, and their certifications are well renouned. This will look really good if you have one or two of these under your belt.
Good luck!
mattster
Because the evidence you've got here definitely looks very good, is there any way you could contact Google and flutter your eyes at them, and they might be really nice?
And maybe DaniWeb should consider a tighter moderating system, not to re-write posts but to step in with stupid things like this. I'm not taking anything from our mod's because I love them and they do a great job, but maybe they should be given the power to do more?
Just hypothetical ideas
^ Read what they are saying: this is garbage, start looking at a server-side language.
everyone can work google.
Except him.
can you tell me..
I have never seen a question so pathetic. Please at least br specific, give examples show what you've tried.
At least make an effort.
So everyone can change their title or is there a post limit?
Well thats what I thought, but theres no $dataArray
defined in his code?
@Borzoi I think you're probably right, if you are, it would've been very helpful of him to have shown what $dataArray
was.
Try using an array and adding to it, that way we can check if there's a value already matching it.
<?php
$result = mysql_query("SELECT category FROM inventory");
$output = array();
while($row = mysql_fetch_array($result)){
$cat_array = array($row['category']);
foreach ($cat_array as $value){
if ($value<=1 && !in_array($value,$output)){ # If $value is already in the array
array_push($output,$value); # Add to array
} # No need for 'else{}'
}
}
foreach($output as $value){
echo $value."<br/>";
}
?>
Probably easier to use this:
<input type="text" pattern="([01]?[0-9]|2[0-3]):[0-5][0-9]" name="timefrom">
The user get's refused when they try to submit, http://www.w3schools.com/tags/att_input_pattern.asp
^^ needs a space beetween the =
and $
, so <?= $row['id']; ?>
Ideally (for good practice PHP) $_SESSION['$dataArray']
should be $_SESSION['dataArray']
. No need for a $
sign within a variable text.
However I'm not sure this is your problem, saying that the variable is undefined suggests an error in defining or add a value to the variable.
Are you certain that you variable is being set correctly? Maybe to check, add echo $_SESSION['$dataArray']
and see what the result is. If it chucks out the right thing, the cause isn't here. If it spits out the wrong thing or an error, then we know where the problem is occurring: setting your value.
^^ Seen this alot lately, how can you guys be appearing lower than me with only 300+ posts?
Did Dani make a change allowing more people to edit their user titles lateley then or something?
How far have you got? What have you done/tried already?
At least make an effort.
rand()
will return a random number so your query will be: 'uploads/12324')
. You need to put a file extension after it.You can't have $variable.'.$variable
etc., because it will just think your second variable is text - try this instead:
move_uploaded_file($file_tmp,'uploads/'.$random_name.$_FILES['file']['type']);
PHP will stick the inverted commas in itself, so just stick thr variables in without '
s either side of them.
Use \"
, so echo "Quote: \"Hello\" ('mattster' of DaniWeb)";
will return:
Quote: "Hello" ('mattster' of DaniWeb)
In context for you:
echo "<input type='submit' name='submit' id='submit' class='btn btn-primary' value=Cancella onclick=\"window.location='delete_article.php?id=".$row['id']."';\" /></p>";
Still a good idea to neaten your code though.
Frameworks are huge things to learn from scratch, to the most elite of developers. For you not to have even Googled what it is, suggests you are in no way capable of this task.
Even if you do manage to scape your way through CodeIgniter and YII, it is unlikely you will finish it to a good enough standard.
Another web design/PHP "expert" who thinks they're an industry pro, yet do not understand echo "Hello World";
.
You might have a question asking for a solution with jQuery version 1.9.X, for instance. But then when someone Googles the same problem 2 years later, when v3.1.0 is out, there might be a much better solution. This guy would resurrect the post with a modern solution, so future Googlers get a high quality answer.
My little story why old posts may need to be left open, to ensure DaniWeb provides the most accurate and helpful solutions to all (including one-time visit Googlers)
came
Hi there!
PHP is an epic language (and my favorite), so can't wait to see you in the PHP forum!
Yes, you can style anything and everything from a CSS file, and much better to do that than place it in a style=""
attribute.
And WYSIWYG means: What You See Is What You Get.
It's a visual editor that allows you to design a website by typing it like any other type of document. The text box you will you to reply is an example of WYSIWYG. Common editors are like DreamWeaver etc.
What they are saying by that is code your website by hand (yes, by yourself), using HTML, from the ground up. This way your code will be reasonably neat and will be a damn site easier to interpret.
Okay thanks very much, so something completely different altogether!
Ahh right, so maybe look at CakePHP or something like that for the time being?
So what happens to DaniWeb if CodeIgniter breaks down and there are no updates? :'O
Hi All,
Over the years I have smashed through God knows how many brick walls with .htaccess
, and all I've learnt is don't even try to make it complicated as nothing is ever simple. I have therefore resorted in recent applications to using mysite.com/index.php/category/sub-category/create/
etc. and PHP to get hold of the values. But this is avoiding a problem rather than solving it.
For instance, the URL I am looking at now is: daniweb.com/web-development/php/17/contribute
.
How would I go about making this in .htaccess
(or moreso how has Dani done it aha).
I normally use this sort of setup:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)/(.+)/(.+)/(.+)$ index.php?cat=$1&subcat=$2&catid=$3&task=$4 [QSA,L]
But it often plays havoc with stylesheets/PHP etc..
Is there a better way to accomplish a URL structure as complex as this? What sort of .htaccess
file does DaniWeb use to support it's huge and complex URL system?
Thanks for the advice
daze
Thankyou very much!
Thanks for your Feed back.
Please mark solved if @Taywin has fixed it and give him some credit
over and over again.
Agreed 100%!
Other than that, maybe really simple CMS site or corporate ones for local business etc.
Okay thankyou, so all I have to do is play with the control panel firewalls to allow the computers to talk to each other and I can access SQL Server from C#?
Thanks for all of your help!
Ever since the dawn of programming, we have had the luxury of variables, OOP, functions and other lovely tools within our languages.
CSS is arguably the easiest language to ever pick up, with everyone having to learn it’s basics. However, it lacks any power, as we have to repeat stuff over and over, which makes it a night mere if you want to quickly make a few changes etc. LESS is a breakthrough in website design, as you can have the beauty of functions and variables – so if you wanted to change your entire colour scheme, it’s as easy of changing one variable.
Just before we begin, download the LESS compiler tar.gz (http://leafo.net/lessphp/) and setup a file system:
I have a home folder, with less
, css
and inc
folders. The inc
filder contains the lessc.inc.php
file and all of the other junk that comes in the TAR.GZ download. The less
folder contains the LESS we’re going to write, and the css
folder will contain the CSS output. In the home folder I have two files: compile.php
and home.php
.
Let’s start with compile.php
. This file must be ran every time you make changes to your LESS.
# Require the LESS include
require "inc/lessc.inc.php";
# Fire up the compiler class
$less = new lessc;
# Run the compiler. Takes everything in style.less, tweaks it, and shoves it all in style.css
$less->compileFile("less/style.less", "css/style.css");
In order to see our magnificent work (and …
Head to something like Magento. You can setup your products on here and intergrate it with PayPal etc. so that you have your own eCommerce shop. You can customise it here.
As for a widget, you can design your own little image bannar or something, and just link it through to your site.
Hope this helps
mattster
Defence paid for uni, and a salary while I was there.
Even if you are the only student in uniform, being the only one with money helps a lot. $3 lunches at the 'Nott'
Of course I like to blow things up
Wow thats some story aha ;) What did you actually do at uni/for a carrer?